Re: Error in the spinner control panel on Catalyst library [message #64174] |
Tue, 09 December 2008 20:47 |
Giorgio
Messages: 31 Registered: March 2008
|
Member |
|
|
Thanks for the replay. We are developing a software tool for data
preparation and we are facing that kind of discussions from time to
time. I think is part of the team work :-)
For me the existence of the buttons is confusing since when you change
a parameter in the spinner control panel and hit Enter, the new value
is taking into account by the spinner automatically. It is not that
you have to press any button (Apply, Cancel or OK) to set the new
parameter in the spinner object. For that reason, I will go for the
No_... buttons keywords. In my preference
Best wishes,
Giorgio
|
|
|
Re: Error in the spinner control panel on Catalyst library [message #64175 is a reply to message #64174] |
Tue, 09 December 2008 15:46  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Giorgio writes:
> I am using the spinners of the catalyst library. I call the control
> panel of the spinner and when I click in either of the lower buttons:
> cancel, apply or ok, I have an error telling that there is no select
> in the event structure returned:
>
> % Tag name SELECT is undefined for structure CATCONTROL_PANEL.
> % Execution halted at: SPINNER::EVENTHANDLER 237 H:\IDLWorkspace
> \catalyst\catalyst\source\widgets\spinner__define.pro
> % CATCONTROLPANEL::EVENTHANDLER 179 H:
> \IDLWorkspace\catalyst\catalyst\source\core
> \catcontrolpanel__define.pro
> % CATEVENTDISPATCHER 175 H:\IDLWorkspace
> \catalyst\catalyst\source\utilities\cateventdispatcher.pro
> % $MAIN$
>
> I see that the event_handler to the method ControlPanel_Events on the
> spinner object. Could this be the problem?
Well, this is an interesting little problem. :-)
When Dave Burridge and I were building the Catalyst Library, we
used to argue incessantly over little things. Normally, one of
us would convince the other in an hour or so of the correctness
of our argument, and we would move on. But, occasionally, we
would have to agree to disagree.
Those OK, APPLY, and CANCEL buttons on ControlPanels were one
of those things. Dave wanted them. I hated them and found them
annoying. We spent at least a week arguing about it, and in the
end we decided to leave them in, but have the ability to turn
them off via keywords. The truth is, I *always* turn them off
when I write ControlPanel methods (although I forgot to do so
this time) and so I occasionally forget to code for them.
So, there are two ways of solving this problem. The way I would
solve it is to set the keywords /NO_OK, /NO_APPLY, and /NO_CANCEL
in the spinner ControlPanel method on the line (112 in my copy)
that creates the spinner control panel. Then, you won't have those
buttons to worry about.
Dave's way of solving this (probably), would be to add cases for
the buttons in the EventHandler method. So right after the code
that is handling SPINNER_TEXTWIDGET events (lines 214-232 in my
copy), I would add the following three lines before the ELSE clause
in the CASE statement:
'OK': self -> SendEvent
'APPLY': self -> SendEvent
'CANCEL': self -> SendEvent
This is your choice, I guess. But I think I am going to go
with the first solution in the official code, unless you
come up with some more convincing argument about why you
need it otherwise. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|