Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: Widget Even...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 10 Topic 5581 of 6456
Post > Topic >>

Re: Widget Event_Pro question

by David Fanning <david@[EMAIL PROTECTED] > Mar 31, 2008 at 06:45 AM

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','VIEW****T','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/
Se****e ma de ni thui. ("Perhaps thou speakest truth.")
 




 10 Posts in Topic:
Widget Event_Pro question
Spon <christoph.blau@[  2008-03-31 04:29:56 
Re: Widget Event_Pro question
David Fanning <david@[  2008-03-31 06:45:55 
Re: Widget Event_Pro question
Spon <christoph.blau@[  2008-03-31 07:14:46 
Re: Widget Event_Pro question
David Fanning <news@[E  2008-03-31 08:45:03 
Re: Widget Event_Pro Bingo
Spon <christoph.blau@[  2008-03-31 07:43:11 
Re: Widget Event_Pro question
Spon <christoph.blau@[  2008-04-02 08:21:04 
Re: Widget Event_Pro question
David Fanning <news@[E  2008-04-02 09:23:49 
Re: Widget Event_Pro question
Spon <christoph.blau@[  2008-04-02 08:38:16 
Re: Widget Event_Pro question
David Fanning <news@[E  2008-04-02 09:47:39 
Re: Widget Event_Pro question
Spon <christoph.blau@[  2008-04-02 09:10:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 20:22:46 CST 2008.