Image wallpapered GUI [message #13715] |
Thu, 03 December 1998 00:00 |
T Bowers
Messages: 56 Registered: May 1998
|
Member |
|
|
Hi all,
I'm trying to create a simple GUI that is a form "wallpapered" with
a .gif image, and a few buttons running down the form (a column of
buttons, if you will) that are centered. Sounds easy enough. First, I
thought
I'd try cw_form(), but theres no way to assign it a background image. So I
thought
I'd be cute and create a baseWidget, then a widget_draw(baseWidget) to hold
my image.gif, then just center my widget_button(baseWidget)'s (or a
cw_bgroup())
on that draw widget. Well... it isn't so easy. I can't use /column with my
baseWidget
so that I can take advantage of the align_center keyword or it'll put the
image lined up
below the buttons. The only way I can get the buttons to appear on top of
the image
is to *not* specify the /column keyword for baseWidget, but then the buttons
appear
on the top/left side and there's no way to align them to center. Hardcoding
the offsets
in there is not an option. The only other way I can think of doing it is to
do the math
on the x and y sizes of my widgets so I can place my buttons in the center
of the draw
widget, but I can't do this cause I can't find a way to access the
dimensions of the damned
widgets.
This is my best crappy solution so far:
pro simpleGUI
;//Pull in my image
read_gif, "image.gif", bkgrnd,r,g,b ;image.gif happens for now to be 200x400
tvlct,r,g,b
;//Create base widget
baseWidget = widget_base()
;//Create base for buttons so they'll line up proper like.
buttonBaseWidget = widget_base(baseWidget, /column, $
xoffset=60, yoffset=110 ;YUCK! This sucks!
;//Get cute and stick in a draw widget
mainFormBkgrnd = widget_draw(baseWidget, xsize=200, ysize=400) ;Yuck again!
;//Make some buttons
button1 = widget_button(baseWidget, value="Button1")
button2 = widget_button(baseWidget, value="Button2")
button3 = widget_button(baseWidget, value="Button3")
;//Do proper stuff
widget_control, baseWidget, /realize
xmanager, "mainForm", baseWidget, /no_block
;//Show background image in mainFormBkgrnd widget
tv, bkgrnd
end
Well... guess that's it in a nutshell. If anyone can decipher this
rambling madness I'd appreciate it a whole lot.
IDL> print,!version
{ x86 Win32 Windows 5.0.2 Jul 23 1997}
TIA
todd bowers, non-widgeting fool
|
|
|