Editbox and Tab key

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
spelman
Posts: 20
Joined: Thu Sep 22, 2011 5:38 pm

Editbox and Tab key

Post by spelman »

Hi everyone,
Is it possible to use the tab key in an Editbox control ?
When my user presses the tab key it changes the focus to the next control on the form ...
I'd like the user to be able to set up columns of data within the edit box, which he can only do by using the spacebar to format the text.
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: Editbox and Tab key

Post by Carlos Britos »

spelman wrote:Hi everyone,
Is it possible to use the tab key in an Editbox control ?
When my user presses the tab key it changes the focus to the next control on the form ...
I'd like the user to be able to set up columns of data within the edit box, which he can only do by using the spacebar to format the text.
HI
Try with oEditBox TABSTOP = .F.
Carlos
Regards/Saludos, Carlos (bcd12a)
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Editbox and Tab key

Post by Rathinagiri »

No. Tabstop will pass on the editbox and you can't enter into the editbox in natural tab order.

For your problem, you can capture the tab key (using 'on key tab') and verify whether editbox is in focus. If it is, you can manually add the required spaces in the caret position. If the edit box is not is focus you can again simulate the tab key.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
spelman
Posts: 20
Joined: Thu Sep 22, 2011 5:38 pm

Re: Editbox and Tab key

Post by spelman »

Hi Rathi,

Thanks very much for the reply - that should do the trick !

Kind Regards,

Steve
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Editbox and Tab key

Post by esgici »

Hi Steve

When you complete, could you share your code with us ?

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
spelman
Posts: 20
Joined: Thu Sep 22, 2011 5:38 pm

Re: Editbox and Tab key

Post by spelman »

I will do that
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: Editbox and Tab key

Post by IMATECH »

Prototype:

Code: Select all


DEFINE WINDOW F_SAMPLE...
...
ON KEY TAB ACTION F_RM_On_Key_Tab()
...
END WINDOW

*-------------------------------------*
*F_RM_On_Key_Tab()
*-------------------------------------*
Function F_RM_On_Key_Tab()
  local i := 0
  * Form/Window Name
  local cFrmName := ThisWindow.Name()
  * active control: name
  local cCtrlName := ThisWindow.FocusedControl()

  * Check if sender is a "Editbox"
  IF GetControlType( cCtrlName, cFrmName ) == "EDITBOX" 
    * ADD two spaces to replace key TAB
    FOR i := 1 TO 2
      _PushKey( VK_SPACE )
    NEXT
  ELSE
    * Next Control
    InsertTab()
  ENDIF

Return( Nil )


Credits: Hathinagiri :)
Last edited by IMATECH on Mon Jul 09, 2012 6:36 am, edited 3 times in total.
M., Ronaldo

By: IMATECH

Imation Tecnologia
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Editbox and Tab key

Post by Rathinagiri »

Nice prototype. However just inserttab() again to simulate the tab key. Please see below:

Function F_RM_On_Key_Tab()
* Form/Window Name
local cFrmName := ThisWindow.Name()
* active control: name
local cCtrlName := ThisWindow.FocusedControl()

* Check if sender is a "Editbox"
IF GetControlType( cCtrlName, cFrmName ) == "EDITBOX"
? Do anything...
ELSE
inserttab()
ENDIF

Return( Nil )
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
IMATECH
Posts: 188
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.

Re: Editbox and Tab key

Post by IMATECH »

Thanks Hathinagiri !


Sample prototype updated above...


Best regards...
M., Ronaldo

By: IMATECH

Imation Tecnologia
Post Reply