Re: Buttons in Widgets [message #80562 is a reply to message #80560] |
Mon, 25 June 2012 05:36   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Helder writes:
> I'm don't like that much how the buttons of IDL widgets
> look (Widget_button) even when using the /bitmap argument.
> I am exploring the solution of using a draw_widget, making
> it of the same color as the background(*) and then filling
> it is with my own drawing. The difference between the two
> methods is that the borders of the buttons will appear
> different: for a button widget these are defined by the
> IDL and for a draw widget one can have "no" borders or
> define how these look like. Another advantage is that
> one can have the effect of having an something like
> an icon floating on a background.
> Has anybody tried doing such things?
Of course. :-)
To be "real" for users (i.e., they get the idea they have
"pushed" something) you need to have two states for your
button: a "normal" look and a "pushed" look. Depending
on how you draw your button, this sometimes is just a
matter of reversing some or all of your colors (you need
about 6-10 to make a decent looking button). You definitely
want to build this as a compound object-widget, because
there is going to be a lot of things your button will
want to remember.
In the end, I think you will find that it is probably
just a whole lot easier and more efficient to change
your attitude about WIDGET_BUTTON and use it. :-)
> (*) Is there a way to find out what color the base
> widget has and/or to define it?
Use the System_Colors keyword to Widget_Info to get
this information. I carried this information around in
cgColor for years, but no one I knew (including me
after I gave up on making my own buttons) ever
used it, so I removed it. It requires a window
connection to obtain these colors, so don't distribute
your application widely, unless you wish additional
headaches. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|