|
Re: Keeping Button Pressed In? [message #45258 is a reply to message #45253] |
Thu, 25 August 2005 20:16   |
Richard French
Messages: 173 Registered: December 2000
|
Senior Member |
|
|
>
> My approach to this problem is to write a compound widget
> (usually an object widget, but it doesn't have to be). The
> "button" is really a draw widget. I create the draw widget
> using PLOTS and POLYFILL in such a way that it actually
> *looks* like a button. And I assign a event handler *function*
> (not procedure) to the draw widget. When an event occurs
> I take it into the event handler and strip out all the
> draw widget stuff, and make the event look like a button
> event structure. I pass this back as the return value of
> the event handler function and IDL treats it as though it
> were an event bubbling up the widget hierarchy. Thus,
> anyone who *uses* the compound widget *thinks* it is a
> button, although it isn't.
>
> When the button is "pressed", I invert the colors I used
> to draw the button, and use light highlighting where before
> I used dark, etc. I really does look as if the button was
> depressed.
>
> Cheers,
>
> David
Wow, that sounds easy! :)
If you tell us the name of the color picking program that was slow on the
mac, we can test it on a firebreathing G5 and see if it is any quicker than
on the laptops.
Dick
|
|
|
Re: Keeping Button Pressed In? [message #45263 is a reply to message #45258] |
Wed, 24 August 2005 20:07   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
hocmin@gmail.com writes:
> I'm new to IDL but have some experience in programming. I'm trying to
> recreate the MS Paint/Adobe Photoshop metaphor with my application
> through a series of image buttons. Basically, I want one button to
> stay pressed down, signifying the "mode" the application is in. Is
> this possible with widget_button's using the /bitmap keyword? I
> realize I could throw something up with radio buttons to achieve the
> same functionality, but I really think the pressed image buttons is a
> more elegant solution.
>
> If not possible, are there any workarounds? I tried using two
> different images, one to make it look like it's pressed. But the
> widget_button has too much padding between the image and the border of
> the button to make it "look" like it's pressed. I couldn't figure out
> a way around this either.
My approach to this problem is to write a compound widget
(usually an object widget, but it doesn't have to be). The
"button" is really a draw widget. I create the draw widget
using PLOTS and POLYFILL in such a way that it actually
*looks* like a button. And I assign a event handler *function*
(not procedure) to the draw widget. When an event occurs
I take it into the event handler and strip out all the
draw widget stuff, and make the event look like a button
event structure. I pass this back as the return value of
the event handler function and IDL treats it as though it
were an event bubbling up the widget hierarchy. Thus,
anyone who *uses* the compound widget *thinks* it is a
button, although it isn't.
When the button is "pressed", I invert the colors I used
to draw the button, and use light highlighting where before
I used dark, etc. I really does look as if the button was
depressed.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|