[Gambas-user] How to automatically select all text when first entering editable TableView cell?
T Lee Davidson
t.lee.davidson at ...626...
Thu Feb 25 03:52:55 CET 2016
I have a project with a TableView that has the cells of certain columns defined as editable since the content can change.
The problem is when the user is editing a row and uses either ENTER or an arrow key to move to the next editable cell, any
existing text in the cell gets in the way and needs to be manually deleted. It's a little annoying to have to continually use
the delete key, or double-click to select all the text.
I'd like all the text to be selected when the cell is first entered via the keyboard, but I cannot figure out how to do that.
The TableView.Activate event is raised when a cell is entered, and so I have tried the following:
[code]
Public Sub TableView1_Activate()
Dim hTextBox As TextBox
TableView1.Edit()
hTextBox = TableView1.Editor
hTextBox.Select()
End
[/code]
(Note: TableView.Editor is a Control and hence does not have a Select method. But TableView.Edit uses a TextBox control by
default to edit the cell.)
But, it doesn't work. No error is raised, but the text is not selected.
Any ideas?
--
Lee
__________
"Artificial Intelligence is no match for natural stupidity."
More information about the User
mailing list