[Gambas-user] Gridview UnselectAll

Rolf-Werner Eilert rwe-sse at osnanet.de
Mon Jan 29 17:48:24 CET 2018


Am 29.01.2018 13:26, schrieb Antonio Teixeira:
> Hi,
>
> We are using Gambas 3.9.1 and we found something wierd on gridview.
>
> The grid has just 1 column, several rows (dont mater how many) and is
> with single line selection activated.
> Clicking in a row a modal form open.
> We have a button that is used to unselect the selected line.
>
> Using the unselectall method he just work once.
>
> After starting the program, we select a line and the modal form opens.
> Then we press the button and the line become unselected.
> If we select another line (or the same), the form opens, and we close her.
> Then we press the button but nothing happens. The line remains selected.
>
> Any help?
>
> ​Thanks in advance.
>
>
> António Teixeira
>
> ​*Ths is the main form code (Just a  gridview and a button):*
> *
> *
> *
> *
> Public Sub Form_Open()
>    GridView1.x = 217
>    GridView1.y = 70
>    GridView1.w = 364
>    GridView1.h = 469
>    GridView1.Rows.count = 100
>    GridView1.Rows.h = 30
>    GridView1.Columns.count = 1
>    GridView1.Mode = Select.Single
> End
>
> Public Sub Button2_Click()
>    GridView1.UnSelectAll
> End
>
> Public Sub GridView1_Click()
>    Form1.ShowModal
> End​
>
>
> *The modal form (Just a button)*
>
> Public Sub Button1_Click()
>    Me.close
> End
>
>


Ok, you want to keep the form with Button1 to stay open all the time, 
and you want to be able to access the Main form at the same time? Then 
you should use Show instead of ShowModal.

ShowModal is for opening forms which must have the user's attention and 
a "Close" or "Cancel" button to close them PRIOR TO be able to access 
the calling form again. It will pass a Value to the Close event, so the 
calling form can read what happened in the meantime. (Personally, I 
prefer to use a number of public variables for this, but it's a matter 
of taste...)

Regards
Rolf



More information about the User mailing list