EditBox control: increase capacity

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

EditBox control: increase capacity

Post by srvet_claudio »

Hi all.
I will outline here a doubt that I answered in another forum.

For default the EditBox control accept as maximum 32,767 characters.
This maximum can be increased to 2,147,483,646 characters if you send the following message to the control:

Code: Select all

#define EM_LIMITTEXT 197
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, 0, 0)
This increases the capacity of EditBox control in 65,538 times.

Best regards,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: EditBox control: increase capacity

Post by esgici »

srvet_claudio wrote:Hi all.

Code: Select all

#define EM_LIMITTEXT 197
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, 0, 0)
Thanks to tip, doc :)
Viva INTERNATIONAL HMG :D
Leopoldo Blancas
Posts: 388
Joined: Wed Nov 21, 2012 7:14 pm
Location: México

Re: EditBox control: increase capacity

Post by Leopoldo Blancas »

Entendido y anotado...

Gracias por el Tip Claudio...
Polo
*-----------------------------------------------------
Understood and annotated ...

Thanks for the Tip Claudio...
Polo
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox control: increase capacity

Post by Pablo César »

We are very lucky to have Dr. Soto in our xBase community.

Your knowledges and sharing make us very rich.

Thank you again Dr. Soto !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: EditBox control: increase capacity

Post by Rathinagiri »

That's great Claudio.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: EditBox control: increase capacity

Post by bpd2000 »

Excellent, Thank you Dr. Claudio.
BPD
Convert Dream into Reality through HMG
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox control: increase capacity

Post by Pablo César »

srvet_claudio wrote:I will outline here a doubt that I answered in another forum.
Dear Claudio, probably something different need to take effect for change capacity, because was tested and still with problem in that example of: http://www.pctoledo.com.br/forum/viewto ... 583#p83583

Please, if you can give a look again would find a solution.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: EditBox control: increase capacity

Post by Carlos Britos »

Pablo César wrote:
srvet_claudio wrote:I will outline here a doubt that I answered in another forum.
Dear Claudio, probably something different need to take effect for change capacity, because was tested and still with problem in that example of: http://www.pctoledo.com.br/forum/viewto ... 583#p83583

Please, if you can give a look again would find a solution.
HI
try with
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, nVALUE, 0)
or
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, -1, 0)
Regards/Saludos, Carlos (bcd12a)
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EditBox control: increase capacity

Post by Pablo César »

Carlos Britos wrote:try with
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, nVALUE, 0)
or
SendMessage (GetControlHandle("EditBox_1","Form_1"), EM_LIMITTEXT, -1, 0)
Hellow Carlos, thank you for your interest. This was solved with this code C:

Code: Select all

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE

#include "HMG_UNICODE.h"

#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"

HB_FUNC (MSG_SETTEXT)
{ 
   SendMessage ((HWND) hb_parnl(1), WM_SETTEXT, 0, (LPARAM) HMG_parc(2));
}

#pragma ENDDUMP
According to Claudio this crash is due one problem in HMG internal function for assigning which he will solve for next releases.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: EditBox control: increase capacity

Post by srvet_claudio »

The problem occurs because when using a very large text there is a crash in the system because the internal functions of HMG to set/get text in the editbox does not support a very large text. In the next release I try fix.

I developed two functions to work with very long texts in EditBox control.

To work with very large texts must change:
Form_1.EditBox_1.Value := cHugeText
for:
MSG_SETTEXT (GetControlHandle("EditBox_1","Form_1"), cHugeText)

and:
cHugeText := Form_1.EditBox_1.Value
for:
cHugeText := MSG_GETTEXT (GetControlHandle("EditBox_1","Form_1"))

Code: Select all

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE

#include "HMG_UNICODE.h"

#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"

HB_FUNC (MSG_SETTEXT)
{ 
   SendMessage ((HWND) hb_parnl(1), WM_SETTEXT, 0, (LPARAM) HMG_parc(2));
}


HB_FUNC (MSG_GETTEXT)
{  UINT nLen = 0;
   TCHAR *cText = NULL;
   nLen = (UINT) SendMessage ((HWND) hb_parnl(1), WM_GETTEXTLENGTH, 0, 0);
   if (nLen > 0)
   {  cText = (TCHAR*) hb_xgrab ((nLen+1) * sizeof(TCHAR));
      if (cText)
      {   SendMessage ((HWND) hb_parnl(1), WM_GETTEXT, nLen+1, (LPARAM) cText);
          HMG_retc( cText );
          hb_xfree( cText );
      }
      else
         HMG_retc(_TEXT(""));
   }
   else
      HMG_retc(_TEXT(""));
}


#pragma ENDDUMP
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply