Gadget Tchat (scrolling)

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
SPH
Messages : 4949
Inscription : mer. 09/nov./2005 9:53

Gadget Tchat (scrolling)

Message par SPH »

Dans ce code, je voulais que le string qui sert a visualier l'ensembre d'une conversation (le string le plus grand, "string_lire") puisse avoir toutes les fonctions qu'a celui d'un tchat;nottament un scrolling vertical automatique qui nous montrerais tjr ce qui se passe dans la derniere ligne. Mais l'ajout d'une fonction a mon gadget actuel a echoué. Pkoi ? Il faut mettre quoi ?? :

Code : Tout sélectionner

; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #IPAddress_0
  #Button_connect
  #String_port
  #String_2
  #String_3
  #String_ecrire
  #String_lire
EndEnumeration


Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 800, 600, "HyperCryptChat",  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered  )
    If CreateGadgetList(WindowID(#Window_0))
      IPAddressGadget(#IPAddress_0, 80, 20, 150, 20)
      ButtonGadget(#Button_connect, 140, 50, 90, 20, "Connect", #PB_Button_Default)
      StringGadget(#String_port, 80, 50, 50, 20, "9009")
      SendMessage_(GadgetID(#String_port), #EM_LIMITTEXT, 5, 0)
      StringGadget(#String_2, 20, 20, 50, 20, "IP :", #PB_String_ReadOnly)
      StringGadget(#String_3, 20, 50, 50, 20, "Port :", #PB_String_ReadOnly)
      StringGadget(#String_ecrire, 20, 560, 760, 20, "")
      ;StringGadget(#String_lire, 20, 90, 760, 450, "", #PB_String_ReadOnly)
      EditorGadget(#String_lire, 20, 90, 760, 450)
      SetGadgetAttribute(#String_lire, #PB_String_ReadOnly, 1)
      ;ScrollBarGadget(#String_lire, 20,90,760,450,760,1000, 2000);  <== raté, je voulais en + rajouté un scrool vertical comme pour un tchat
      
      
    EndIf
  EndIf
EndProcedure


Open_Window_0()

Repeat  
   Event = WaitWindowEvent()  
   Select event 
      Case #PB_Event_Gadget
         
         Select EventGadget()
            Case #Button_connect
            port=Val(GetGadgetText(#String_port))
            If (port<0 Or port>65535) Or GetGadgetText(#IPAddress_0)="0.0.0.0"
               txt$="Indiquez une adresse IP valide et un port inoccupé (compris entre 0 et 65535)"
               ;EditorGadget(#String_lire, 8, 8, 306, 133)
            Else
               txt$="Tentative de connection "+GetGadgetText(#IPAddress_0)+":"+GetGadgetText(#String_port)
            EndIf
            ;SetGadgetText(#String_lire,txt$)
            AddGadgetItem(#String_lire, 0, txt$) 
         EndSelect
   EndSelect
Until Event = #PB_Event_CloseWindow

Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Message par Droopy »

Répondre