Verfasst: 02.01.2008 22:11
wiso?
Code: Alles auswählen
a$="text1"
b$="text2"
c$="text3"
irgendetwas$=a$+b$+c$
=
irgendetwas$="text1"+"text2"+text3"
=
irgendetwas$="text1text2text3"
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)
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