Unlimited content in a editor gadget?

Just starting out? Need help? Post your questions and find answers here.
Snoop0304
User
User
Posts: 45
Joined: Wed Jul 12, 2006 7:57 pm
Location: Germany
Contact:

Unlimited content in a editor gadget?

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Snoop0304
User
User
Posts: 45
Joined: Wed Jul 12, 2006 7:57 pm
Location: Germany
Contact:

Post 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.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Snoop0304
User
User
Posts: 45
Joined: Wed Jul 12, 2006 7:57 pm
Location: Germany
Contact:

Post 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?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply