comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Tip for using Compound Widgets
items: Re: Tip for using Compound Widgets

Tip for using Compound Widgets
type: item
description: I do a lot of widget programming in IDL, and I've recently come across an elegant solution I'd like to share. Others have probably already thought of this, or may have a better idea, so I hope I'll start a dialog. Suppose you have a complex compound widget with lots of differnt functions. You want to tell it to do all kinds of things, but you don't want to lose that "black box" aspect that makes cw_widgets so powerful. So for each differnt thing I want the widget to do, I encode the command in the name of a structure and then pass that as a SET_VALUE in a WIDGET_CONTROL as follows: WIDGET_CONTROL, cw_ID, SET_VALUE={COMMAND_TYPE, arg1:val1, arg2:val2, . . . } so it might look like one of these: WIDGET_CONTROL, cw_ID, SET_VALUE={NEW_IMAGE, img_ptr:ptr_new(image)} WIDGET_CONTROL, cw_ID, SET_VALUE={SET_RANGE, range:[0, 16383]} WIDGET_CONTROL, cw_ID, SET_VALUE={REFRESH_DISPLAY, VIEWPLANE_RECT=[0,0,10,20]} In order to make this work, a few things are required. Here are some details. 1) The compound widget function is defined with a SET_VALUE routine. That is, the first base you declare has a SET_VALUE explicitly set to a routine that you're using to interpret these commands. 2) I use the IDL-recommended trick of storing a state variable (generally a big structure with widget IDs and object pointers to everything that needs to be changed) in the UVALUE of the first child widget of the main base. I created a function and a procedure to get and set the first child's UVALUE in one command (see below). IMPORTANT NOTE: If you use this method, don't forget that every time you update the state variable, you have to *save it* in the UVALUE of the base's first child. Otherwise changes could be lost. So every call of "state = first_child_uvalue(id)" should be followed by a "first_child_set_uvalue, base, state". 3) The compound widget's set_value procedure may look like this ;----------- ; Procedure to execute commands sent by SET_VALUE keyword to WIDGET_CONTROL ; pro cw_test_set_val…
creator: MKatz843
date: 2002-08-03T19:03:19-00:00

Re: Tip for using Compound Widgets
type: item
description: Rob Preece (Rob.Preece@msfc.nasa.gov) writes: > Good grief! You are *this* close to creating a 'command macro' language > for your widget objects (something I have been thinking about for some > time, I might add!). All that is needed is a way to store lists of > commands, so that they could be replayed at any time. It would be nice to > edit, store and recall these lists. Finally, think about a *recordable* > widget program: hit a button, and the following user actions are saved as > a list of commands, to be available for later replay... I think you are talking about my LinkedList object and the LinkedList editor, that is built, but not available to the public. :-) Actually, the system we are building does all the things you mention and more. To "process" an image, we store "process" objects in its container. You can add them, remove them, change their order, etc. We are torn, at the moment, between wanting to become famous by writing a book that explains all this, or to become rich by writing programs with the system. I'll let you know the next time you are in Fort Collins. :-) Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. 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
creator: David Fanning
date: 2002-08-29T17:51:41-00:00

Re: Tip for using Compound Widgets
type: item
description: David Fanning wrote: > > We are torn, at the moment, between wanting to become > famous by writing a book that explains all this, or > to become rich by writing programs with the system. My $0.02... go with the second option. You're already famous. :o) paulv -- Paul van Delst CIMSS @ NOAA/NCEP/EMC Ph: (301)763-8000 x7274 Fax:(301)763-8545
creator: Paul Van Delst[1]
date: 2002-08-29T18:36:54-00:00

Re: Tip for using Compound Widgets
type: item
description: Paul van Delst (paul.vandelst@noaa.gov) writes: > My $0.02... go with the second option. You're already famous. :o) You must know my wife. :-) Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. 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
creator: David Fanning
date: 2002-08-29T18:57:15-00:00

Re: Tip for using Compound Widgets
type: item
description: David Fanning wrote: > > I'll let you know the next time you are in Fort > Collins. :-) Alas, this does not work. Tried it, but the Coyote found his way out of the trap :-( Pavel
creator: Pavel A. Romashkin
date: 2002-09-03T16:20:58-00:00

Re: Tip for using Compound Widgets
type: item
description: Pavel A. Romashkin (pavel_romashkin@hotmail.com) writes: > David Fanning wrote: >> >> I'll let you know the next time you are in Fort >> Collins. :-) > > Alas, this does not work. Tried it, but the Coyote found his way out of > the trap :-( Sorry, I should have said "the next time you are in Fort Collins and I don't have high school tennis practice, my own league tennis match, back to school night, and my nephew's birthday party all scheduled on the same night." :-) Cheers, David P.S. Let's just say missing Back to School night to play tennis is considered BAD JUDGEMENT by certain people around here. :-( -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. 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
creator: David Fanning
date: 2002-09-03T17:01:35-00:00