Re: CASE a UNAME?? [message #27474] |
Thu, 25 October 2001 07:26  |
Logan Lindquist
Messages: 50 Registered: October 2001
|
Member |
|
|
David,
Thanks Again for the Help!
Logan
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.164142b35a4bfde3989723@news.frii.com...
> Logan Lindquist (llindqusit@mrdoc.cc) writes:
>
>> I would like my program to do a CASE statement in an
>> event handler procedure that is the same for two different
>> options in the menu of my program. Say I want to change
>> the window size by selecting a different option in my
>> menu. By doing a CASE statement on the UNAME of the
>> different options I can figure out which option created
>> the event? So I guess the Question of the hour is:
>> What is the best way to find which Widget_Button
>> created an event in a general event handler procedure
>> called by several such Widget_Button's?
>
> I typically look at the button's value.
>
> Widget_Control, event.id, Get_Value=buttonValue
> CASE buttonValue OF
>
> Just be sure you spell this in your case statement
> *exactly* the way you spelled it on the button!
>
> Cheers,
>
> David
>
> --
> 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
|
|
|
|
Re: CASE a UNAME?? [message #27478 is a reply to message #27474] |
Thu, 25 October 2001 05:01  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Dear Logan,
this is a widget with uname from our idl lecture.
regards
Reimar
pro wid5_event,event
widget_control,event.top,get_uvalue=x
CASE Event.id OF
WIDGET_INFO(event.top,find_by_uname='QUIT') :$
WIDGET_CONTROL,event.top,/destroy
WIDGET_INFO(event.top,find_by_uname='PRINT') : $
BEGIN
id=WIDGET_INFO(event.top,find_by_uname='TEXT')
WIDGET_CONTROL,id,set_value=(*x).value
(*x).value='neuer Text'
END
ELSE:
ENDCASE
end
pro wid5
x={value:'Hallo Du'}
x=ptr_new(x,/no_copy)
id_base=widget_base(row=3)
id_PRINT=widget_button(id_base,value='PRINT',$
uname='PRINT')
id_quit=widget_button(id_base,value='QUIT',$
uname='QUIT')
id_text=widget_text(id_base,value='',uname='TEXT')
widget_control,id_base,/realize,set_uvalue=x
xmanager,'wid5',id_base
ptr_free,x
end
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======
read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
|
|
|
Re: CASE a UNAME?? [message #27482 is a reply to message #27478] |
Wed, 24 October 2001 21:29  |
Logan Lindquist
Messages: 50 Registered: October 2001
|
Member |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Wait I guess <FONT face=Arial
size=2>'find_by_uname' really doesn't work if I want to find which Widget_Button
called my event handler function. Back to square one. haha</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Logan</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></FONT>"Logan Lindquist" <<A
href="mailto:llindqusit@mrdoc.cc">llindqusit@mrdoc.cc</A>> wrote in message
<A
href="news:9r83gg$k2u$1@sulawesi-fi.lerc.nasa.gov">news:9r83gg$k2u$1@sulawesi-fi.lerc.nasa.gov</A>...</DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=Arial size=2>Umm, nevermind. I found it. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BLOCKQUOTE></BODY></HTML >
|
|
|
Re: CASE a UNAME?? [message #27483 is a reply to message #27482] |
Wed, 24 October 2001 21:19  |
Logan Lindquist
Messages: 50 Registered: October 2001
|
Member |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Umm, nevermind. I found it. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is from the IDL Help.. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>IDL GUIBuilder
Examples</STRONG></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>...........</FONT></DIV>
<DIV><FONT face=Arial size=2>Note that the callback routine finds the label
widget using the FIND_BY_UNAME keyword with the name value you gave the widget
in the Properties dialog.</FONT></DIV>
<DIV><FONT face=Arial size=2>...........</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>; Toggle the mapping of the two IDL sub-bases
and</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>; get the Widget IDs of the two
sub-bases.<BR> wBase1 = Widget_Info(Event.top,
find_by_uname="base1")<BR> wBase2 = Widget_Info(Event.top,
find_by_uname="base2")<BR> <BR> ; Now update the
mapping.<BR> widget_control, wBase1, map=(Event.index eq
0)<BR> widget_control, wBase2, map=(Event.index eq 1)</FONT></DIV>
<DIV><FONT face=Arial size=2>...........</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is an example from Pavel Bure [just kidding I
don't think he's really the hockey player from the Florida Panthers... this last
name is much easier for me to remember .. and spell than Pavel's real last
name]. Pavel added it to the procedure that the Widget_Draw object calls, so
that's what I'm going to do.</FONT></DIV>
<DIV><FONT face=Arial size=2>......</FONT></DIV>
<DIV><FONT face=Arial size=2>widget_control, widget_info(event.top,
find_by_uname='THE_DRAW'), get_value=win_id</FONT></DIV>
<DIV><FONT face=Arial size=2>......</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Gosh I love it when I answer my own questions. Well
not out loud..</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks Pavel,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Logan</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Logan Lindquist" <<A
href="mailto:llindqusit@mrdoc.cc">llindqusit@mrdoc.cc</A>> wrote in message
<A
href="news:9r81fm$jio$1@sulawesi-fi.lerc.nasa.gov">news:9r81fm$jio$1@sulawesi-fi.lerc.nasa.gov</A>...</DIV></BLOCKQUOTE></BODY></HTML>
|
|
|
Re: CASE a UNAME?? [message #27484 is a reply to message #27483] |
Wed, 24 October 2001 21:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Logan Lindquist (llindqusit@mrdoc.cc) writes:
> I would like my program to do a CASE statement in an
> event handler procedure that is the same for two different
> options in the menu of my program. Say I want to change
> the window size by selecting a different option in my
> menu. By doing a CASE statement on the UNAME of the
> different options I can figure out which option created
> the event? So I guess the Question of the hour is:
> What is the best way to find which Widget_Button
> created an event in a general event handler procedure
> called by several such Widget_Button's?
I typically look at the button's value.
Widget_Control, event.id, Get_Value=buttonValue
CASE buttonValue OF
Just be sure you spell this in your case statement
*exactly* the way you spelled it on the button!
Cheers,
David
--
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
|
|
|