Page 1 of 1

Editbox and Tab key

Posted: Fri Jul 06, 2012 4:50 am
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.

Re: Editbox and Tab key

Posted: Fri Jul 06, 2012 3:57 pm
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

Re: Editbox and Tab key

Posted: Fri Jul 06, 2012 5:46 pm
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.

Re: Editbox and Tab key

Posted: Fri Jul 06, 2012 5:54 pm
by spelman
Hi Rathi,

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

Kind Regards,

Steve

Re: Editbox and Tab key

Posted: Sat Jul 07, 2012 1:47 pm
by esgici
Hi Steve

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

Regards

--

Esgici

Re: Editbox and Tab key

Posted: Sun Jul 08, 2012 4:38 am
by spelman
I will do that

Re: Editbox and Tab key

Posted: Sun Jul 08, 2012 11:50 pm
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 :)

Re: Editbox and Tab key

Posted: Mon Jul 09, 2012 2:16 am
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 )

Re: Editbox and Tab key

Posted: Mon Jul 09, 2012 6:35 am
by IMATECH
Thanks Hathinagiri !


Sample prototype updated above...


Best regards...