Re: problem with widget_draw and draw_button_events under windows [message #53414] |
Fri, 13 April 2007 16:08  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Justus Skorps writes:
> btw now the 'get one position'-function gives me again the
> problem..without doing any changes to the code about the involved
> widgets...perhaps I should try the gui on another windows pc..
I really don't think the problem is with your PC.
I'm always suspicious of complicated event handlers.
What happens if you send all your draw widget events
to a separate draw widget event handler and make that
as simple as possible?
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.")
|
|
|
|
Re: problem with widget_draw and draw_button_events under windows [message #53429 is a reply to message #53426] |
Fri, 13 April 2007 07:50   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Justus Skorps writes:
> Of course you were right about a programming error, I know that one
> click gives two events, and I thought that I had considerd that, but I
> confused the roles of event.press and event.type...now I corrected
> that and it works now very well for the 'get one position'-function.
> But I tried a function to get two positions, and this leads to the
> same problem as before, I get my four values and then the crosshair
> won't like to disappear. I guess this will be due to an similar
> mistake in my code, although both functions have the same if-condition
> at the beginning. But I hope I will find a nice little mistake.
In general, in this kind of situation, I let any button event
that is not a button down event flow though my event handler
without processing. I usually only take action if I get a
button down event:
PRO MY_EVENT_HANDLER, event
IF event.type NE 0 THEN RETURN
; Handle button down events here.
CASE event.press OF
1; Left button
4: Right button
ELSE: ; I don't care.
ENDCASE
END
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.")
|
|
|
Re: problem with widget_draw and draw_button_events under windows [message #53430 is a reply to message #53426] |
Fri, 13 April 2007 06:37   |
Justus Skorps
Messages: 20 Registered: April 2007
|
Junior Member |
|
|
> I've written an awful lot of widget programs on Windows XP
> and never noticed this problem, which leads me to suspect
> a programming error rather than something more sinister.
>
> I wonder if adding a CLEAR_EVENTS keyword to the WIDGET_CONTROL
> line where you turn button processing OFF would help? Also,
> do you realize when you get a button event in a draw widget
> that TWO events are generated? One for the button down and
> one for the button up. It sounds to me like a draw widget
> event is "hanging" somewhere and not getting processed.
Thanks for your answer.
Of course you were right about a programming error, I know that one
click gives two events, and I thought that I had considerd that, but I
confused the roles of event.press and event.type...now I corrected
that and it works now very well for the 'get one position'-function.
But I tried a function to get two positions, and this leads to the
same problem as before, I get my four values and then the crosshair
won't like to disappear. I guess this will be due to an similar
mistake in my code, although both functions have the same if-condition
at the beginning. But I hope I will find a nice little mistake.
Thanks again for your help,
Justus
I tried the clear_events keyword, but same problem. I recently found
out, that as long as I don't unset the draw_button_events, I get no
problem.
|
|
|
Re: problem with widget_draw and draw_button_events under windows [message #53432 is a reply to message #53430] |
Fri, 13 April 2007 07:11   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Justus Skorps writes:
> Now my problem: Normally, when I move the cursor above the draw
> window, it changes to a crosshair, when I leave the draw window, it
> changes back to an pointer. But after I used the function mentioned
> above (with correct behaviour), the cursor doesn't change back, it
> stays a crosshair all over the screen, and I am not able to press any
> other button, slider,... in my gui or else where. The only solution is
> to bring another program, i.e. the windows explorer, to front and then
> change back to IDL/the gui..then everything is okay again.
>
> But this problem appears only when using the gui under WindowsXP with
> IDL 6.2., on Solaris with IDL 6.2. I have no such problem. Anybody
> knows a solution to get rid of this problem?
I've written an awful lot of widget programs on Windows XP
and never noticed this problem, which leads me to suspect
a programming error rather than something more sinister.
I wonder if adding a CLEAR_EVENTS keyword to the WIDGET_CONTROL
line where you turn button processing OFF would help? Also,
do you realize when you get a button event in a draw widget
that TWO events are generated? One for the button down and
one for the button up. It sounds to me like a draw widget
event is "hanging" somewhere and not getting processed.
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.")
|
|
|
Re: problem with widget_draw and draw_button_events under windows [message #53713 is a reply to message #53414] |
Mon, 23 April 2007 23:57  |
Justus Skorps
Messages: 20 Registered: April 2007
|
Junior Member |
|
|
ok, I think it finally works now..
I kept in mind that one click on a draw gives me to events, and I
thought that an if-condition would be enough to deal with that...but
the problem seems to be, that I disabled the draw_button_event-
property of the draw in the same part of code where I was evaluating
the x and y values I got from the event, but the next event in line to
be executed by the event handler was now an event from a disabled
source...and I think that led to my problem...now I wrote the
disabling of the draw_button_event in an extra if-condition reacting
on the release of the click...
thanx again for your help!
and btw: your book is really very helpfull...just bought the online
version, since I had to bring my borrowed library exemplar back...
|
|
|