[Gambas-user] TAB and TextArea

Tobias Boege tobiasboege01 at ...1601...
Wed Aug 1 22:45:22 CEST 2012


On Wed, 01 Aug 2012, Matti wrote:
> Recently, there was a question about the TAB Focus. Testing this, I saw:
> In every control the TAB key is used to move the cursor to the next control.
> But TextArea behaves different: the TAB key inserts spaces into the control and 
> doesn't move the cursor.
> I'm not sure if this is wanted behaviour or not.
> Should the TAB key switch to the next control, should it insert spaces, or 
> should there be an option?
> Regards Matti
> 

I'm sure, nobody would like to miss the ability to insert tabs/spaces using
the Tab key. It is not default in Gambas to indent using Tabs (actually, you
can indent with the Tab key in the source code editor but it is filled with
spaces, right?) but think of other Editors/programming languages where the
Tab is a fundamental character for indentation.
Essentially: yes, I'm sure it is intentional.

However, if you feel to not allow the Tab key to insert tabs, you have sort
of an option to do so:

Public Sub TextArea1_KeyPress()
  If Key.Code = Key["Tab"] Then
    ' Move focus to next control somehow
    Stop Event ' Stop insertion of the Tab character
  Endif
End

I don't know if this code works and how to move the focus to the next
controls (Is there any representation of this Hierarchy tab from the form
editor somewhere at runtime?) but you got the idea, hopefully.

This could be turned into an property-like option for the TextArea and
related controls but it's not me to decide that.

Regards,
Tobi




More information about the User mailing list