Restored from previous forum. Originally posted by teachco.
A great wish: MultiLineTextGadget , MultiLineStringGadget (automatic scrollbars of course)
TextGadget und StringGadget don't not work correctly with Chr(10) and Chr(13).
It's not possible to generate a CR within a string, because the both gadgets are not able to interpret these unprintable chars correctly.
MultiLineTextGadget MultiLineStringGadget
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Rings.
There are some more flags than those written in the Helps.
But please note that thy are Windows-specific only !
CodeGuru
Its a long way to the top if you wanna .....CodeGuru
There are some more flags than those written in the Helps.
But please note that thy are Windows-specific only !
Code: Select all
If OpenWindow(0, 100, 100, 500,400, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
If CreateGadgetList(WindowID())
Textbox=StringGadget(0, 10, 10, 480, 380, "Codeguru is there!",#PB_String_Multiline|#ES_AUTOVSCROLL|#WS_VSCROLL |#WS_HSCROLL)
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
EndIf
End
Its a long way to the top if you wanna .....CodeGuru
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by H.Brill.
hi,
here is an code that extrcat and count the lines in the multiedit.
the CountGadgetItems(...) and GetGadgetItemText(...) functions don't
works. i have written my own procedures.
;
; ------------------------------------------------------------
;
; PureBasic - Muster - Datei für Multi - Edit
;
; (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Die Proceduren Del(), SubStr(), GetStringCount() und GetListString() helfen,
; damit der String, der mit GetGadgetText() aus dem mehrzeiligen Editfeld herausgezogen wurde,
; richtig verarbeitet werden kann. Der String besteht aus mehrer Chr(13) + Chr(10), halt soviele
; wie man Zeilen aingegeben hat. Diese muß man separat herausfiltern.
; Die PB - Funktionen CountGadgetItems(...) und GetGadgetItemText(...) greifen bei diesem Editfeld nicht.
i.l
Procedure.s Del(n1.s, n2.w, n3.w)
; Diese Procedure stammt aus dem Forum (MRK-Soft)
n.s = Mid(n1, 1, n2 - 1) + Mid(n1, n2 + n3, Len(n1))
ProcedureReturn n
EndProcedure
Procedure.s SubStr(n1.s, n2.w, n3.s)
; Diese Procedure stammt aus dem Forum (MRK-Soft)
n2 = n2 - 1
If n2 > - 1
For sr.w = 1 To n2
pos.w = FindString(n1, n3, fpos)
If pos > 0
fpos = pos + 1
Else
fpos = Len(n1) + 1
EndIf
Next sr
hp.s = Mid(n1, fpos, Len(n1))
pos.w = FindString(hp, n3, 0)
If pos = 0
pos = Len(n1)
Else
pos = pos - 1
EndIf
procs.s = Mid(hp, 1, pos)
EndIf
ProcedureReturn procs
EndProcedure
Procedure.l GetStringCount(p1.s)
pos.l
ct.l = 0
x.l
For x = 1 To Len(p1)
pos = FindString(p1, "," , x)
If pos > 0
x = pos + 1
Del(p1, x, 1)
ct = ct + 1
EndIf
Next x
ProcedureReturn ct
EndProcedure
Procedure.s GetListString(p1.s, p2.l)
trenn.s = ","
sub.s = Trim(SubStr(p1, p2, trenn))
ProcedureReturn sub
EndProcedure
If OpenWindow(0, 100, 100, 600, 460, #PB_Window_SystemMenu | #PB_Window_MinimizeGadGet, "Fenster")
If CreateGadgetList(WindowID())
TextGadget(1, 5, 50, 70, 25, "Zeile :")
StringGadget(6, 80, 50, 240, 120, "", #PB_String_Multiline|#ES_AUTOVSCROLL|#WS_VSCROLL|#WS_HSCROLL)
ButtonGadget(11, 5, 200, 60, 25, "Add")
ButtonGadget(12, 85, 200, 60, 25, "Löschen")
ButtonGadget(13,165, 200, 60, 25, "Ende")
ListViewGadget(30, 5, 280, 590, 160)
EndIf
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventCloseWindow
Quit = 1
Case #PB_EventGadGet
Select EventGadgetID()
Case 11
; Button 1
zeile.s = GetGadgetText(6)
z.s = ReplaceString(zeile, Chr(13) + Chr(10), ", ", 1)
count.l = GetStringCount(z)
For i = 1 To count
zeile = GetListString(z, i)
AddGadgetItem(30, -1, zeile)
Next i
Case 12
; Button 2
Case 13
; Button 3
Quit = 1
Case 30
; Listbox
EndSelect
EndSelect
Until Quit = 1
EndIf
hi,
here is an code that extrcat and count the lines in the multiedit.
the CountGadgetItems(...) and GetGadgetItemText(...) functions don't
works. i have written my own procedures.
;
; ------------------------------------------------------------
;
; PureBasic - Muster - Datei für Multi - Edit
;
; (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Die Proceduren Del(), SubStr(), GetStringCount() und GetListString() helfen,
; damit der String, der mit GetGadgetText() aus dem mehrzeiligen Editfeld herausgezogen wurde,
; richtig verarbeitet werden kann. Der String besteht aus mehrer Chr(13) + Chr(10), halt soviele
; wie man Zeilen aingegeben hat. Diese muß man separat herausfiltern.
; Die PB - Funktionen CountGadgetItems(...) und GetGadgetItemText(...) greifen bei diesem Editfeld nicht.
i.l
Procedure.s Del(n1.s, n2.w, n3.w)
; Diese Procedure stammt aus dem Forum (MRK-Soft)
n.s = Mid(n1, 1, n2 - 1) + Mid(n1, n2 + n3, Len(n1))
ProcedureReturn n
EndProcedure
Procedure.s SubStr(n1.s, n2.w, n3.s)
; Diese Procedure stammt aus dem Forum (MRK-Soft)
n2 = n2 - 1
If n2 > - 1
For sr.w = 1 To n2
pos.w = FindString(n1, n3, fpos)
If pos > 0
fpos = pos + 1
Else
fpos = Len(n1) + 1
EndIf
Next sr
hp.s = Mid(n1, fpos, Len(n1))
pos.w = FindString(hp, n3, 0)
If pos = 0
pos = Len(n1)
Else
pos = pos - 1
EndIf
procs.s = Mid(hp, 1, pos)
EndIf
ProcedureReturn procs
EndProcedure
Procedure.l GetStringCount(p1.s)
pos.l
ct.l = 0
x.l
For x = 1 To Len(p1)
pos = FindString(p1, "," , x)
If pos > 0
x = pos + 1
Del(p1, x, 1)
ct = ct + 1
EndIf
Next x
ProcedureReturn ct
EndProcedure
Procedure.s GetListString(p1.s, p2.l)
trenn.s = ","
sub.s = Trim(SubStr(p1, p2, trenn))
ProcedureReturn sub
EndProcedure
If OpenWindow(0, 100, 100, 600, 460, #PB_Window_SystemMenu | #PB_Window_MinimizeGadGet, "Fenster")
If CreateGadgetList(WindowID())
TextGadget(1, 5, 50, 70, 25, "Zeile :")
StringGadget(6, 80, 50, 240, 120, "", #PB_String_Multiline|#ES_AUTOVSCROLL|#WS_VSCROLL|#WS_HSCROLL)
ButtonGadget(11, 5, 200, 60, 25, "Add")
ButtonGadget(12, 85, 200, 60, 25, "Löschen")
ButtonGadget(13,165, 200, 60, 25, "Ende")
ListViewGadget(30, 5, 280, 590, 160)
EndIf
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventCloseWindow
Quit = 1
Case #PB_EventGadGet
Select EventGadgetID()
Case 11
; Button 1
zeile.s = GetGadgetText(6)
z.s = ReplaceString(zeile, Chr(13) + Chr(10), ", ", 1)
count.l = GetStringCount(z)
For i = 1 To count
zeile = GetListString(z, i)
AddGadgetItem(30, -1, zeile)
Next i
Case 12
; Button 2
Case 13
; Button 3
Quit = 1
Case 30
; Listbox
EndSelect
EndSelect
Until Quit = 1
EndIf
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Rings.
Under Windows you can use SendMessage to retrieve more info/set.
try this:
Its a long way to the top if you wanna .....CodeGuru
Under Windows you can use SendMessage to retrieve more info/set.
try this:
Code: Select all
If OpenWindow(0, 100, 100, 500,400, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
If CreateGadgetList(WindowID())
Textbox=StringGadget(0, 10, 30, 480, 360, "",#PB_String_Multiline|#ES_AUTOVSCROLL|#WS_VSCROLL |#WS_HSCROLL)
Label=TextGadget(1,1,1,400,22,"INFO")
Button=ButtonGadget(2,440,1,30,22,"Down")
Button=ButtonGadget(3,470,1,30,22,"UP")
;Create some lines
For line=1 To 300
info.s=info + "CodeGuru is there in Line:"+Chr(9)+Str(line) +Chr(9)
For I=1 To 40
Info.s=info + Chr(Random(52)+65)
Next i
info=info + Chr(13)+Chr(10)
Next line
SetGadgetText(0,Info)
Repeat
EventID.l = WaitWindowEvent()
Result=SendMessage_(TextBox,#EM_GetSel,@Anfang,@Ende)
Zeichen=Anfang
Zeile=SendMessage_(TextBox,#EM_LINEFROMCHAR,Zeichen,0)+1
Zeilenanzahl=SendMessage_(TextBox,#EM_GETLINECOUNT,0,0)
Info.s="Position:"+Str(Zeichen)+" in Line:"+Str(Zeile)+" from Linecount:"+Str(Zeilenanzahl)
SetGadgetText(1,Info)
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
If EventID = #PB_Event_Gadget
Gadget = EventGadgetID()
If Gadget=3
Zeile=SendMessage_(TextBox,#EM_SCROLL,#SB_PAGEUP,0)
EndIf
If Gadget=2
Zeile=SendMessage_(TextBox,#EM_SCROLL,#SB_PAGEDOWN,0)
EndIf
EndIf
Until Quit = 1
EndIf
EndIf
End