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

Fabien Bodard gambas.fr at ...626...
Thu Feb 25 22:29:43 CET 2016


2016-02-25 20:30 GMT+01:00 Charlie <charlie at ...2793...>:
> Hi Jorge,
> I looked at you solution but have a couple of points:-
> 1/. To select all the text in a TextBox there is no need for any more than
> *TextBox1.Select*
Well it seem there is a problem with gtk for that.

> 2/. Even if, having added a TextBox as an editor, you change T Lee's code to
> the below it doesn't work for me: -
> * TableView1.Editwith(TextBox1)
>  TextBox1.Select
> * Can you provide code that works as it would be better than my 'Shelling'
> example?


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




More information about the User mailing list