Re: Q on widget programming style [message #12425 is a reply to message #12421] |
Tue, 28 July 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mirko Vukovic (mvukovic@my-dejanews.com) writes:
> In my widget programming I tend to assign an event handler to each widget
> (well, almost), since that eliminates testing on the origin of the event,
> and produces somewhat cleaner code.
>
> But are there any pitfalls to that practice?
Uh, it produces a lot of code. :-)
I tend, these days, to use a lot of event handlers too, but
I tend to group them by logical function or utility. For example,
all of the buttons in the "Processing" pull-down menu will be
handled by the same event handler. Or all the "color tools" will
be handled by the same event handler, etc.
This tends to cut down on the amount of code a little bit
and makes it easier to find the part of the code I want to
work on.
I'm also very big these days on writing compound widgets as
objects. Normally this will mean a single event handler, but
many methods for the compound widget. Maybe it's my imagination,
but it seems very elegant to me. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|