comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Widget Event_Pro question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Widget Event_Pro question [message #59479 is a reply to message #59478] Mon, 31 March 2008 06:45 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Spon writes:

> As part of a little image display programme, I've currently got a draw
> widget:
>
> Display = WIDGET_DRAW(Base, XSIZE = S[0], YSIZE = S[1], $
> /MOTION_EVENTS, EVENT_PRO = 'SLIDESHOWWIDGET_GETVALUES')
>
> And I'd like to add button events to it. I don't want to get rid of
> the motion events though. The easiest way that I can think of adding
> functionality is to (ideally) have two Event_Pro strings, one to be
> run if a motion event is detected, another if a mouse click is
> detected.
>
> Is there a way of doing this?
>
> Or am I just stuck making my SLIDESHOWWIDGET_GETVALUES programme big,
> confusing and unwieldy?

This will depend entirely on what kind of IDL programmer you
are. :-)

You can't have two different event handlers assigned to a
widget at the same time, but there is nothing that prevents
that single event handler from being an event dispatcher.
The event comes in. The event handler figures out what kind
of event it is (e.g., button up, button down, motion,
expose, etc.), and then the event is passed onto some other
IDL procedure or function for further processing. Often,
the info pointer is also needed, along with the event structure,
to completely handle the event.

PRO MyProg_DrawWidgetEventProcessing, event

; Get info pointer.
Widget_Control, event.top, GET_UVALUE=infoPtr

; What kind of event is this?
kind =
['DOWN','UP','MOTION','VIEWPORT','EXPOSE','CH','KEY','WHEEL' ]
CASE kind[event.type] OF
'DOWN': MyProg_HandleButtonDownEvents, event, infoPtr
'UP': MyProg_HandleButtonUpEvents, event, infoPtr
'MOTION': MyProg_HandleButtonMotionEvents, event, infoPtr
ELSE: ; 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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why Persist with the IDL Workbench
Next Topic: Warm and fuzzy tip

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 17:20:59 PDT 2025

Total time taken to generate the page: 0.00188 seconds