Fragen zu StringGadget

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
Joel
Beiträge: 851
Registriert: 21.04.2006 19:22

Beitrag von Joel »

wiso?
----------------------------------------------------------

PB 5.20 Beta 10 | Windows 7
marco2007
Beiträge: 906
Registriert: 26.10.2006 13:19
Kontaktdaten:

Beitrag von marco2007 »

Wieso?

Code: Alles auswählen

a$="text1"
b$="text2"
c$="text3"

irgendetwas$=a$+b$+c$
=
irgendetwas$="text1"+"text2"+text3"
=
irgendetwas$="text1text2text3"
Windows 11 - PB 6.03 x64
_________________________________
Benutzeravatar
Joel
Beiträge: 851
Registriert: 21.04.2006 19:22

Beitrag von Joel »

Code: Alles auswählen

#PB_String_Multiline = 4 
StringGadget(Nummer,x,y,Breit,Hoch,"",#PB_String_Multiline|#WS_VSCROLL|#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT)
Gibt es dass, "schreib in nächster Zeile weiter" auch für Editor Gadget?
----------------------------------------------------------

PB 5.20 Beta 10 | Windows 7
marco2007
Beiträge: 906
Registriert: 26.10.2006 13:19
Kontaktdaten:

Beitrag von marco2007 »

Das hatte ich auch mal vor kurzem gesucht. Naja verwenden tu ich`s trotzdem nicht.

Trotzdem: Toller Code von Sparkie:
http://www.purebasic.fr/english/viewtop ... 6223#86223

Code: Alles auswählen

Global editFont.l 
editFont = LoadFont(0, "Verdana", 10) 

; --> Procedure for creating multiline, wordwrap edit control 
Procedure CreateWordrapEdit(controlId, x, y, width, height, text$) 
  ; you can add #WS_EX_CLIENTEDGE For border 
  hEdit = CreateWindowEx_(#WS_EX_LEFT | #WS_EX_LTRREADING | #WS_EX_RIGHTSCROLLBAR, "Edit", text$, #WS_CHILD | #WS_GROUP | #WS_VSCROLL | #WS_TABSTOP | #WS_VISIBLE | #ES_AUTOVSCROLL | #ES_LEFT | #ES_MULTILINE , x, y, width, height, WindowID(0), controlId, GetModuleHandle_(0), 0) 
  SendMessage_(hEdit, #WM_SETFONT, editFont, 1) 
  ProcedureReturn hEdit 
EndProcedure 

; --> Procedure for setting edit control text 
Procedure SetEditText(editId, editText$) 
  result = SendMessage_(editId, #WM_SETTEXT, 0, editText$) 
  ProcedureReturn result 
EndProcedure 

; --> Procedure for getting edit control text 
Procedure.s GetEditText(editId) 
  ; --> Get the text lenght  (we add 1 for ending null) 
  tlen = SendMessage_(editId, #WM_GETTEXTLENGTH, 0, 0) + 1 
  editText$ = Space(tlen) 
  SendMessage_(editId, #WM_GETTEXT, tlen  , @editText$) 
  ProcedureReturn editText$ 
EndProcedure 

If OpenWindow(0, 0, 0, 300, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
  ; --> Create our edit control 
  edit_0 = CreateWordrapEdit(0, 5, 5, 290, 150, "This is my wordrap Edit control") 
  ButtonGadget(1, 40, 165, 100, 20, "Change text") 
  ButtonGadget(2, 150, 165, 100, 20, "Get text") 
  Repeat 
    event = WaitWindowEvent() 
    Select event 
      Case #PB_Event_Gadget 
        Select EventGadget() 
          Case 1 
            ; --> Setting the text 
            SetEditText(edit_0, "This is my new text.") 
          Case 2 
            ; --> Getting the text 
            eText$ = GetEditText(edit_0) 
            MessageRequester("The text is", eText$) 
        EndSelect 
    EndSelect 
  Until event = #PB_Event_CloseWindow 
EndIf 
End
Windows 11 - PB 6.03 x64
_________________________________
Antworten