Page 1 of 1

Unlimited content in a editor gadget?

Posted: Sat Jul 29, 2006 10:16 am
by Snoop0304

Code: Select all

Case #WM_COMMAND
  If wParam=#EN_MAXTEXT
    test=SendMessage_(*edit,#EM_GETLIMITTEXT,0,0)
    SendMessage_(*edit,#EM_SETLIMITTEXT,SendMessage_(*edit,#EM_GETLIMITTEXT,0,0)+10000,0)
  EndIf
With this code I tried to increase the possible content in a editor gadget, when the #EN_MAXTEXT-Message is sent.
Look also at this (it's from the PSDK):

Code: Select all

Limiting User Entered Text
The default limit to the amount of text a user can enter in an edit control is 32 KB. An application can change the default limit by sending the control an EM_SETLIMITTEXT message. This message sets a hard limit to the number of bytes the user can enter into an edit control, but affects neither text that is already in the control when the message was sent nor text copied to the control by the SetDlgItemText function or the WM_SETTEXT message. For example, suppose that the application uses the SetDlgItemText function to place 500 bytes in an edit control, and the user also enters 500 bytes (1,000 bytes total). If the application then sends an EM_SETLIMITTEXT message limiting user-entered text to 300 bytes, the 1,000 bytes already in the edit control remain there, and the user cannot add any more text. On the other hand, if the application sends an EM_SETLIMITTEXT message limiting user-entered text to 1,300 bytes, the 1,000 bytes remain, but the user can add 300 more bytes.
When the user reaches the character limit of an edit control, the system sends the application a WM_COMMAND message containing an EN_MAXTEXT notification message. This notification message does not mean that memory has been exhausted, but that the limit for user-entered text has been reached; the user cannot enter any more text. To change this limit, an application must send the control a new EM_SETLIMITTEXT message with a higher limit. 
As an example of the use of EM_SETLIMITTEXT and EN_MAXTEXT, suppose that the application must limit the user to no more than four characters in an edit control. The application would use EM_SETLIMITTEXT to specify a four-character limit. If the user tried to enter a fifth character, the system would send an EN_MAXTEXT notification message to the application.
Please help me.

Posted: Sat Jul 29, 2006 10:57 am
by Trond
And editor gadget isn't an edit control.
Editor gadget: Rich edit control
String gadget: Edit control

On Windows 2000/XP there is no limit to the text length in a rich edit. On Windows 9.x there is a very hard limit at 64kb.

Posted: Sat Jul 29, 2006 11:36 am
by gnozal
Trond wrote:On Windows 2000/XP there is no limit to the text length in a rich edit. On Windows 9.x there is a very hard limit at 64kb.
IIRC, the 32k/64k limit is only for EDIT controls in Win9x, not for RICHEDIT controls (EM_EXLIMITTEXT message).

Posted: Sun Jul 30, 2006 6:58 pm
by Snoop0304
Trond wrote:On Windows 2000/XP there is no limit to the text length in a rich edit. On Windows 9.x there is a very hard limit at 64kb.
I used the editor gadget of Pure Basic and there is a limit!
Look at this please: http://lp0304.g4.gs/fast-edit.rar
Load a big file (4 MB for example) and you'll see that there nothing happens, if you're pressing the the return button on your keyboard.

Posted: Sun Jul 30, 2006 7:41 pm
by ts-soft
Use this:

Code: Select all

SendMessage_(GadgetID(#Gadget), #EM_LIMITTEXT, -1, 0)
I have load a 12 MB file for testing :wink:

Posted: Sun Jul 30, 2006 7:43 pm
by Snoop0304
ts-soft wrote:Use this:

Code: Select all

SendMessage_(GadgetID(#Gadget), #EM_LIMITTEXT, -1, 0)
I have load a 12 MB file for testing :wink:
I'll test it and I hope that it will be OK! Thank you.

> I have load a 12 MB file for testing
Was it ok, or what happend?

Posted: Sun Jul 30, 2006 8:06 pm
by ts-soft
Snoop0304 wrote: > I have load a 12 MB file for testing
Was it ok, or what happend?
No problem with my Editor :wink: