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:

Re: EditBox control: increase capacity

Post by srvet_claudio »

Wow Carlos, nice idea.
but with the new functions of HMG the code is more simple.

Code: Select all

#include "hmg.ch"

Function Main

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'HMG Demo' ;
      ICON 'DEMO.ICO' ;
      MAIN
 
      @ 30,10 EDITBOX Edit_1 ;
         WIDTH 410 ;
         HEIGHT 140 ;
         VALUE 'EditBox!!';
         MAXLENGTH 0       // same as --> SendMessage (GetControlHandle("Edit_1","Form_1"), 197, 0, 0 )

      DEFINE BUTTON D
         ROW   250
         COL   290
         WIDTH   130
         CAPTION  '_GetCaretPos'
         ACTION   MsgInfo (Form1.Edit_1.CaretPos)  // ---> MsgInfo() --> convert xData to STR

      END BUTTON

   END WINDOW

   // CREATE EVENT PROCNAME OnkeyEdit_1() HWND GetControlHandle("Edit_1","Form_1")     // --> Work only with Form1.Edit_1
   CREATE EVENT PROCNAME OnkeyAllEditBox()                                             // --> Work with all EditBox controls

   Form_1.Center()

   Form_1.Activate()


Return Nil


Function OnkeyEdit_1()
   IF EventMSG() == WM_CHAR
      IF .NOT. (GetKeyState(VK_INSERT) == 0) .AND. HMG_GetLastVirtualKeyDown() != VK_RETURN .AND. HMG_GetLastVirtualKeyDown() != VK_BACK
         SendMessage (EventHWND(), WM_KEYDOWN, VK_DELETE, 0)
      ENDIF
   ENDIF
Return NIL


Function OnkeyAllEditBox()
LOCAL nIndex := GetControlIndexByHandle (EventHWND())
   IF nIndex > 0 .AND. GetControlTypeByIndex (nIndex) == "EDIT"
      IF EventMSG() == WM_CHAR
         IF .NOT. (GetKeyState (VK_INSERT) == 0) .AND. HMG_GetLastVirtualKeyDown() != VK_RETURN .AND. HMG_GetLastVirtualKeyDown() != VK_BACK
            SendMessage (EventHWND(), WM_KEYDOWN, VK_DELETE, 0)
         ENDIF
      ENDIF
   ENDIF
Return NIL
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
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 »

Uhmm looks promising solution... :) Thanks Carlos and Claudio !

Hi dear Claudio, in your example are missing these functions:
  • EVENTMSG
    HMG_GETLASTVIRTUALKEYDOWN
    EVENTHWND
    GETCONTROLINDEXBYHANDLE
    GETCONTROLTYPEBYINDEX
I assume that will be available in the next release, but could you please anticipate to all of us ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
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 »

I do not know what the rest of his colleagues opine, but IMHO this new option of OVERWRITE in EDIT controls by key pressed, could be incorporated into the function INITEDITBOX C:\hmg.3.1.4\SOURCE\c_editbox.c adding a new property (a new parameter) as an option for the programmer.

Something like this:

DEFINE EDITBOX Edit_1
        ROW 30
        COL 10
        WIDTH 500
        HEIGHT 140
        VALUE "EditBox!!"
        OVERWRITE .T.
        ..//..
END EDITBOX

And this routine of key control would be only activated if OVERWRITE is .T.
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 »

Pablo César wrote:Uhmm looks promising solution... :) Thanks Carlos and Claudio !

Hi dear Claudio, in your example are missing these functions:
  • EVENTMSG
    HMG_GETLASTVIRTUALKEYDOWN
    EVENTHWND
    GETCONTROLINDEXBYHANDLE
    GETCONTROLTYPEBYINDEX
I assume that will be available in the next release, but could you please anticipate to all of us ?
Yes, these are functions of the new version.
Pablo César wrote:I do not know what the rest of his colleagues opine, but IMHO this new option of OVERWRITE in EDIT controls by key pressed, could be incorporated into the function INITEDITBOX C:\hmg.3.1.4\SOURCE\c_editbox.c adding a new property (a new parameter) as an option for the programmer.
Later I will try to develop a real routine overwriting.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: EditBox control: increase capacity

Post by Carlos Britos »

srvet_claudio wrote:

Code: Select all

 
      @ 30,10 EDITBOX Edit_1 ;
         WIDTH 410 ;
         HEIGHT 140 ;
         VALUE 'EditBox!!';
         MAXLENGTH 0   // same as --> SendMessage (GetControlHandle("Edit_1","Form_1"), 197, 0, 0 )

Hello Claudio
I was looking at the example code and the option "MaxLenght = 0" would invalidate the use of that property for text.
Regards/Saludos, Carlos (bcd12a)
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: EditBox control: increase capacity

Post by Carlos Britos »

Carlos Britos wrote: I was looking at the example code and the option "MaxLenght = 0" would invalidate the use of that property for text.
Forget it, I'm wrong. :oops:

Los penales no me dejaron pensar claro. :lol:
Regards/Saludos, Carlos (bcd12a)
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 »

Carlos Britos wrote:Los penales no me dejaron pensar claro. :lol:
Los penales errados hoy contra Francia y en la Copa de las Confederaciones contra Italia no me dejan dormir.
Pero como dijo hoy un colombiano en la pagina web de la FIFA: "pa´lante uruguayos, vamos que el segundo es el mejor entre los perdedores" :lol: :lol: :lol:
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: EditBox control: increase capacity

Post by EduardoLuis »

Hi Friends:

Did you consider where you'll store EditBox contents ?
Take notice of this:

*.txt file: Max. 65535 char
memo Field: Max. 29958 (aprox.)

To solve storage problem using large Editbox contents, you must split text on portions which it size matches with storage output.-
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 »

EduardoLuis wrote: Take notice of this:

*.txt file: Max. 65535 char
memo Field: Max. 29958 (aprox.)

To solve storage problem using large Editbox contents, you must split text on portions which it size matches with storage output.-
Hello Eduardo

As far as I know text limit is for Clipper and memo field limit is for DBFNTX.

In Window environment and by using Harbour and DBFCDX will be everything OK 8-) ( hopefully ;) )

There will be other limits, but I couldn't reached yet ;)

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: EditBox control: increase capacity

Post by EduardoLuis »

Hi Esguici:

I've tested limits with HMG DBFNTX.-
Now i'll test limits with HMG DBFCDX.-
Thanks for you suggestion.-
Eduardo.-
Post Reply