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

Home » Public Forums » archive » Re: Interfacing the functions
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: Interfacing the functions [message #30120 is a reply to message #30118] Mon, 08 April 2002 07:56 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Akhila (idlfreak@yahoo.com) writes:

> Thanx for ur help. But its difficult to control all these functions
> using mouse. I'd like to have buttons and after clicking the button
> for a particular function, the mouse move or up or down will perform
> that operation.
>
> Eg: When i click on the zoom button, then i'd like to zoom in and out
> using the mouse up/down/move.
>
> Something similar to XOBJVIEW in the lib/utilities. I am not able to
> comprehend that code. can somebody help me with that or suggest some
> simpler version.

Oh, dear. Let me try.

You create your four buttons: "Zoom", "Pan", "Adjust", "Next".
The event handler for the buttons sets up the current "mode":

PRO Button_Events, event
IF event.select NE 1 THEN RETURN
Widget_Control, event.top, Get_UValue=info, /No_Copy
Widget_Control, event.id, Get_Value=buttonValue
info.currentMode = buttonValue
Widget_Control, event.top, Set_UValue=info, /No_Copy
END

You have four different event handler procedures written
that do the different functions: "zoom_events", "pan_events",
"adjust_events", and "next events". You already have these
event handler procedures written, it sounds like. So you
attach a new event handler to the draw widget, call it
"draw_widget_events". Its purpose is to call the real
event handler based on what mode the program is currently in:

PRO Draw_Widget_Events, event
Widget_Control, event.top, Get_UValue=info, /No_Copy
CASE info.currentMode OF
'Zoom': zoom_events, event
'Pan': pan_events, event
'Adjust': adjust_events, event
'Next': next_events, event
ENDCASE
Widget_Control, event.top, Set_UValue=info, /No_Copy
END

It really is about that simple. :-)

Cheers,

David

P.S. But I agree with Mark, this really should be written
as an object. :-)

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Alpha Blending
Next Topic: Re: Need help identifying left most zero bit

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

Current Time: Mon Dec 01 11:06:10 PST 2025

Total time taken to generate the page: 0.64516 seconds