[scilab-Users] Re: General callback for events on figures

Samuel Gougeon sgougeon at free.fr
Thu Jul 26 14:40:27 CEST 2012


Hello David,

Thanks for your message.
For comparison, i am afraid that nobody would expect that events from
the mouse would be detected and processed with any
xgetmouse_left(..), xgetmouse_right(..), xgetmouse_center(..),
xgetmouse_wheel(...)
mouse family, according to the triggering button, rather than simply
xgetmouse(...)

Yet, it is somewhat what it is presently proposed for windows events.

If a case-processing would certainly be required, it is a common situation.
A switch with 100  alternatives may be said as big, with 5 ones: is likely
very common.

By the way, as you have noticed, with a single callback, an action that
should be done for several types of events could be written only once.

 From defining a common callback function myWindowEventHandler(trigger, 
params)
called by
resizefcn = "myWindowEventHandler(''resize'',...)"
or by
closerequestfcn = "myWindowEventHandler(''close'',...)"
or by
iconifyfcn = "myWindowEventHandler(''iconify'',...)"
to only
callback = "myWindowEventHandler(...)"
the trigger'sid being implicitly passed to the handler in argin#1
there is a small step resuming N similar properties into a single one.

IMO, multiplying very similar properties does not make at all the
language clearer. There are already quite numerous examples
in Scilab of such similar ungathered features that make the language
rather obscur.

This is why this kind of situation should be discussed and if possible
avoided before being implemented, spread, and used.
Afterwards, backcompatibility issues are somewhat locking.

Regards
Samuel

Le 26/07/2012 08:22, David Chèze a écrit :
> Hi Samuel,
>
> compared by other similar programming language that provide a GUI maker, as
> far i know, events are generated very specifically for each target behavior,
> 1 event<=>  1 callback function : i guess it is to keep function code as
> short/clear as possible, by preventing kind of big switch{} or if then
> elseif... The drawback is that it's not so easy to manage common behavior
> for similar events and the whole code is then bigger, maybe more risk to
> write wrong things in that case.
>
> David
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/General-callback-for-events-on-figures-tp4024637p4024638.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
>
> --
> To unsubscribe from this mailing-list, please send an empty mail to
> users-unsubscribe at lists.scilab.org
> To check the archives of this mailing list, see
> http://mailinglists.scilab.org/
>
>
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120726/3fe7f5b2/attachment.htm>


More information about the users mailing list