[Gambas-user] datechooser bugged?

Tobias Boege taboege at ...626...
Tue Jul 8 15:15:23 CEST 2014


On Tue, 08 Jul 2014, Federico Allegretti wrote:
> No events could be used to code except *Change* and *Activate*
> .... all the list of events is useless ?
> 
> i'll noticed because i need to prevent the user to change date if actual
> job scheduling was not saved in the db (i planned to use the 'stop event')
> ... but "click" event is not present for datechooser, nor mouse-down or
> mouse up .....
> 
> Any hint?
> 

DateChooser is a compound UserControl, i.e. it contains lots of other stuff
like Buttons, a SpinBox, a DrawingArea, etc.. It is itself the event observer
of its children (as usual) so that it can process their events to function
correctly.

The programmer simply does not want to or cannot forward each MouseDown,
etc. event from each of its child controls to you and the rationales are:
it would be a great effort to do so, very unreadable and the only benefit is
that you *could maybe* use these events to extend the control from the
outside. However, you could also mess it all up by forcing things that the
DateChooser does not support by its own.[*]

The best is to look at the sources[0] for the events that are actually
supported - or the documentation[1]: the implemented events are not italic.

But what Fabien suggested, to use the Enabled property, should work in your
case and personally I would find it more natural (what I can't use should
look grey and do nothing, not look normal and do nothing for some reason).

Regards,
Tobi

[0] http://sourceforge.net/p/gambas/code/HEAD/tree/gambas/trunk/comp/src/gb.form/.src/Date/DateChooser.class
[1] http://gambaswiki.org/wiki/comp/gb.form/datechooser

[*] A cruel hack which just came to my mind is: you can run through the
    Children array since actually a UserControl is a Container. For each
    child you can create an observer with the same event name as your
    DateChooser. You may need to do this process recursively if you hit
    another container. Then you should be able to process each MouseDown
    coming from inside the DateChooser. Not tested.

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list