[Gambas-user] Databrowser/Gridview events?
Ron
ron at ...1740...
Thu Sep 3 15:30:45 CEST 2009
Jean-Yves F. Barbier wrote:
> Ron a écrit :
>
>> Is it possible to catch events from a DataBrowser object?
>>
>> Lets say
>> PUBLIC SUB DataBrowser1_MouseUp()
>> ...
>> END
>> PUBLIC SUB DataBrowser1_DblClick()
>> ...
>> END
>>
>> The docs say those are valid but I cannot get it to work, they dont seem
>> to get called, anyone use these?
>>
>> Gambas 2.15.2, qt.
>>
>
> Wild guess: they're preempted by the sorting command it applies to a column
> when you click on its header.
>
> JY
>
Ok, found it out myself just now.
I wanted to catch a click on a row of a DataBrowsers GridView so I can
display an image alongside with the name of the text in column 0 of the
row clicked.
So I implemented an Observer to peek at the DataBrowser.GridView events,
and it worked!
Something like this:
PRIVATE hObserver AS Observer
PUBLIC SUB Form_Open()
hObserver = NEW Observer(DataBrowser1.GridView) AS "GridObserver"
END
PUBLIC SUB GridObserver_Click()
DisplayProduct(DataBrowser1.GridView[DataBrowser1.GridView.Row, 0].Text)
END
I love this language!
Regards,
Ron_2nd.
More information about the User
mailing list