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

Home » Public Forums » archive » Re: Keeping Button Pressed In?
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: Keeping Button Pressed In? [message #45263 is a reply to message #45258] Wed, 24 August 2005 20:07 Go to previous messageGo to previous message
David Fanning is currently offline  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/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Constrained Optimization routine
Next Topic: Bases de datos

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

Current Time: Wed Oct 08 19:26:09 PDT 2025

Total time taken to generate the page: 0.00344 seconds