Cursor position when tabbing into a GET

Cursor position when tabbing into a GET

Postby xProgrammer » Sun Mar 16, 2008 4:04 am

Apart from first GET in a DIALOG cursor seems to go to the end of the contents when tabbing into a GET. Whereas it would be nice for it to go to the end of the non-blank text and / or the start.

This is in part due to the way I have programmed - which may not be necessary. But xBase GETS have always operated such that if you want the user to be able to enter up to ten characters you had to set the variable associated with the GET to SPACE(10) rather than "".

But I see that GTK+ 2.0 has the following method:
Code: Select all  Expand view
gtk_entry_set_max_length ()

void                gtk_entry_set_max_length            (GtkEntry *entry,
                                                         gint max);


Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.

entry :
a GtkEntry

max :
the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

If we can set maximum lengths perhaps we can initialise our variables to "" and the cursor positioning will be better.

But it would be even better if in addition you could expose the got-focus event for us and we also could use:
Code: Select all  Expand view
gtk_editable_set_position ()

void                gtk_editable_set_position           (GtkEditable *editable,
                                                         gint position);

Sets the cursor position.

editable :
a GtkEditable widget.

position :
the position of the cursor. The cursor is displayed before the character with the given (base 0) index in the widget. The value must be less than or equal to the number of characters in the widget. A value of -1 indicates that the position should be set after the last character in the entry. Note that this position is in characters, not in bytes.

On top of that exposing the got-focus method might give us a way of programming around the problem we have with selection going to the top of a browse if we tab into it before mouse clicking on it.

Regards
Doug
(xProgrammer)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 30 guests