[Gambas-user] How to automatically select all text when first entering editable TableView cell?

T Lee Davidson t.lee.davidson at ...626...
Fri Feb 26 01:21:56 CET 2016


On 02/25/2016 04:29 PM, Fabien Bodard wrote:
> The code below work well. It seem that the code in table view interact
> after the activate event on the editor. So the workaround
> is to do the selection after the event. That is what my code do
>
>
>
> ' Gambas class file
>
> Private hEditor As TextBox
> Private obs As Observer
> Public Sub Form_Open()
>
>    TableView1.Columns.Count = 3
>    TableView1.Rows.Count = 4
>    TableView1[0, 0].Text = "lhddhdlhddkhdkhe"
>    TableView1[0, 1].Text = "kljkljhdljdhdljh"
> End
>
> Public Sub TableView1_Activate()
>    'Dim hEditor As TextBox
>    TableView1.Edit
>    hEditor = TableView1.Editor
>    obs = New Observer(hEditor, True) As "OBS"
>
>
> End
>
> Public Sub OBS_GotFocus()
>
>    hEditor.Select(0, Len(hEditor.Text))
>
> End

I thought indeed this was my solution, Fabien. But alas, it does not work for me on Qt.

I don't have 'xdotools', Charlie, so I didn't give your interesting solution a try. But, it did give me an idea. And the 
solution is so simple.

This works for me on Qt:

Public Sub TableView1_Activate()

   TableView1.Edit()
   Desktop.SendKeys("{[Control_R]a}")

   Return

End


Thank you all for your responses.



Lee
__________

"Artificial Intelligence is no match for natural stupidity."





More information about the User mailing list