[Gambas-user] Chronic columnview Woes
Richard Terry
rterry at ...1823...
Wed May 15 03:35:26 CEST 2013
Benoît Minisini wrote:
> Le 08/05/2013 02:03, Richard Terry a écrit :
>
>> Hi List,
>>
>>
> > ...
> >
>
>> However, lets say I want to popup a menu of the letters collection:
>>
>> If I right mouse click on the list to bring up the menu the
>> cvwLetters_Menu event triggers, but if one inspects the cvwLetters
>> control itself in the IDE, the cvwLetters.item.key is null, however the
>> cvwletters.selected[0] does contain the value one would expect to be in
>> the cvwLetters.item.key.
>>
>> I've tried doing e.g cvwLetters.movecurrent() before popping up the
>> menu, this does not seem to make much difference.
>>
>
> The Menu event is not an event managed by the ColumnView control, but by
> its Control parent class. This is the reason why the Item property is
> not set during the Menu event handler. The Menu event is raised even if
> you don't click on an item.
>
> Normally, the Click event will be raised before the Menu event, and so
> you can store the key of the ColumnView.Item property during the Click
> event handler (which is a ColumnView event) to use it later during the
> Menu event handler.
>
>
>> Also I've a chronic problem trying to generate a columnview click event
>> in code, with a similar outcome to the above - the item.key is not set
>>
>
> The Item property *is* set during a Click event handler. What are you
> talking about with "generate a columnview click event"?
>
>
What I meant was this. Lets say you have loaded the columnview with
data. Now, if the user was sitting in front of the program and wanted to
select an item in the columnview, then he would click on the column
which one would then trap the event and do something with it.
I often need to be able to emulate that in code, ie have the program do
the same thing. Doing this
columnview1.Movefirst()
columnview1.item.selected = True
will sometimes work ie this triggeres the columnview1_Select() routine
and any code associated with this.
Hope this is clearer.
Regards
Richard
Richard
More information about the User
mailing list