Increasing capacity of StringGadget
Increasing capacity of StringGadget
I just did some searching here but didn't find the answer, but I'm sure
someone had some code to increase the capacity of a StringGadget?
Currently it can only hold 30000 bytes of data, but I need way more...
(And yes, I tried the EditorGadget, but it only holds 32767 bytes).
someone had some code to increase the capacity of a StringGadget?
Currently it can only hold 30000 bytes of data, but I need way more...
(And yes, I tried the EditorGadget, but it only holds 32767 bytes).
For the stringgadget, use this to increase the size:
This one is for EditorGadget:
Timo
Code: Select all
SendMessage_(GadgetID(#String), #EM_LIMITTEXT, NewSize, 0)
Code: Select all
SendMessage_(GadgetID(#Editor), #EM_EXLIMITTEXT, 0, NewSize)
Timo
quidquid Latine dictum sit altum videtur
There is no mention of an upper limit for the EditorGadget() so i guess
it would be up to 2 GB?? Never tested that though
For Stringgadget, there are some limits depending on the used system:
to 64K. So if you want more, you have to use memory buffers to
handle the strings.
Timo
it would be up to 2 GB?? Never tested that though
For Stringgadget, there are some limits depending on the used system:
However, you must keep in mind, that the PB string system is limitedBefore EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.
Edit controls on Windows NT/2000/XP: For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either –1 bytes or the value of the wParam parameter, whichever is smaller.
Edit controls on Windows 95/98/Me: For single-line edit controls, the text limit is either 0x7FFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either 0xFFFF bytes or the value of the wParam parameter, whichever is smaller.
to 64K. So if you want more, you have to use memory buffers to
handle the strings.
Timo
quidquid Latine dictum sit altum videtur
> you must keep in mind, that the PB string system is limited to 64K
Actually, Fred posted a way to increase it -- and it works great! I'm
now using strings of 1 MB instead of the tiny 64 K default, with no
bad speed loss in my apps. Since his tip was in the middle of a long
thread, I've re-posted it as standalone tip here (and put it in the FAQ):
viewtopic.php?p=45054
Actually, Fred posted a way to increase it -- and it works great! I'm
now using strings of 1 MB instead of the tiny 64 K default, with no
bad speed loss in my apps. Since his tip was in the middle of a long
thread, I've re-posted it as standalone tip here (and put it in the FAQ):
viewtopic.php?p=45054
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact:
Code: Select all
SendMessage_(GadgetID(#Editor), #EM_EXLIMITTEXT, 0, NewSize)
How should I set the new size if i want to have a 120 Kb EditorGadget?
> There is no mention of an upper limit for the EditorGadget() so i guess
> it would be up to 2 GB?? Never tested that though
Is this confirmed with PureBasic v4.00 at all? Or to put it another way: what
is the EditorGadget's default size? Do I need to use the SendMessage API to
increase it if I want to load a 500 KB file, etc?
> it would be up to 2 GB?? Never tested that though
Is this confirmed with PureBasic v4.00 at all? Or to put it another way: what
is the EditorGadget's default size? Do I need to use the SendMessage API to
increase it if I want to load a 500 KB file, etc?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Michael Vogel
- Addict
- Posts: 2666
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Increasing capacity of StringGadget
Any chance to increase the StringGadget content to allow more than 1024 characters in multiline mode?
When you try to paste content into the following gadgets, it fails for the multiline type:
When you try to paste content into the following gadgets, it fails for the multiline type:
Code: Select all
s.s=Space(1000)
z.s=s+"|<1000 1024>|"
If OpenWindow(0,0,0,1066,100,"StringGadget Flags", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
c=StringGadget(0, 58,10,1000,20,"")
SendMessage_(c,#EM_LIMITTEXT,10000,0)
SetGadgetText(0,z)
c=StringGadget(1, 58,40,1000,20,"",#ES_MULTILINE)
SendMessage_(c,#EM_LIMITTEXT,10000,0)
SetGadgetText(1,z)
TextGadget(2,8,10,40,20,"")
TextGadget(3,8,40,40,20,"")
Repeat
SetGadgetText(2,Str(Len(GetGadgetText(0))))
SetGadgetText(3,Str(Len(GetGadgetText(1))))
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Increasing capacity of StringGadget
It works if you TYPE the extra text, but not if PASTING extra text, which is weird.Michael Vogel wrote:When you try to paste content into the following gadgets, it fails for the multiline type
StringGadgets() don't officially support multiline mode (#ES_MULTILINE is just a hack).
- Michael Vogel
- Addict
- Posts: 2666
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Increasing capacity of StringGadget
Interesting, im am using PB 5.45 on Windows 8.1 and can't add additional characters by using the keyboard - only SetGadgetText seems to ignore the limit of 1024 characters. No difference when the unicode compiler option i set.
I am using the multiline flag to allow centering the text within the gadget as seen here (the following code doesn't show any new behaviour, it's just to demonstrate how the text is vertically centered within the gadget...)
I am using the multiline flag to allow centering the text within the gadget as seen here (the following code doesn't show any new behaviour, it's just to demonstrate how the text is vertically centered within the gadget...)
Code: Select all
s.s="|"+Space(999)
z.s=s+"|<1000 1024>|"
; z="< more characters> "+z
Procedure StringGadgetInitialize(GadgetID)
#StringGadgetBorder=6
#StringGadgetHeight=28
Protected hdc
Protected fsz.Size
Protected Rect.Rect
Protected font
font=GetGadgetFont(GadgetID)
GadgetID=GadgetID(GadgetID)
hdc=GetDC_(GadgetID)
SelectObject_(hdc,font)
GetTextExtentPoint32_(hdc,"|",1,fsz)
ReleaseDC_(GadgetID,hdc)
GetWindowRect_(GadgetID,Rect)
Global StringGadgetOffset=Rect\bottom-Rect\top
StringGadgetOffset=StringGadgetOffset>>1-fsz\cy<<4/20; cy*16/20 (Text eher weiter oben) bis cy*16/22 (eher weiter unten)
EndProcedure
Procedure StringGadgetAlignment(GadgetID)
Protected hwndEdit
Protected erect.Rect
hwndEdit=GadgetID(GadgetID)
GetClientRect_(hwndEdit,eRect)
erect\left=#StringGadgetBorder
eRect\top=StringGadgetOffset
eRect\bottom=#StringGadgetHeight
SendMessage_(hwndEdit,#EM_SETRECT,0,eRect)
EndProcedure
If OpenWindow(0,0,0,1066,120,"StringGadget Flags", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
c=StringGadget(0, 58,10,1000,35,"")
SendMessage_(c,#EM_LIMITTEXT,10000,0)
StringGadgetInitialize(0)
SetGadgetText(0,z)
c=StringGadget(1, 58,50,1000,35,"",#ES_MULTILINE)
SendMessage_(c,#EM_LIMITTEXT,10000,10000)
StringGadgetAlignment(1)
SetGadgetText(1,z)
TextGadget(2,8,10,40,35,"",#SS_CENTERIMAGE)
TextGadget(3,8,50,40,35,"",#SS_CENTERIMAGE)
Repeat
SetGadgetText(2,Str(Len(GetGadgetText(0))))
SetGadgetText(3,Str(Len(GetGadgetText(1))))
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Increasing capacity of StringGadget
We're up to v5.62 now, so try it with that version on Windows 8.1 and see.Michael Vogel wrote:im am using PB 5.45 on Windows 8.1 and can't add additional characters by using the keyboard
- Michael Vogel
- Addict
- Posts: 2666
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Increasing capacity of StringGadget
At least the version 5.61 does the same like 5.45, so I must do another update, Dude