A little gui problem

Hi,

I am putting together a little gui - and maybe trying to do something impossible.

The attached testTheGui.C makes a TGMainFrame that contains a horizontally arranged TGCompositeFrame. The composite frame contain a TGListBox and a TGTextButton. Note that they are both set with kLHintsExpandX. This is nice because if I drag the main windows size, things rescale dynamically.

However, I don’t want the TGListBox and TGTextButton to have the same width, it makes sense for the TGListBox to use up most of the available width. I know I can set the widths manually if I don’t use kLHintsExpandX - however, I then lose the ability to scale things dynamically when the window size is dragged. This is demonstrated in testTheGui2.C

Is it possible to set things up such that the TGListBox uses (say) 90% of the available width and things scale dynamically as the window size is dragged?

By the way - in testTheGui2, I am confused that I cannot set the button width using Resize(w,h)

I am using root trunk 5.27/01 on OS X 10.6 with gcc 4.2.1

thanks!
Peter
testTheGui2.C (1.47 KB)
testTheGui.C (1.44 KB)

Hi Peter,

See your modified example in attachment (and take a look at the comments in the code)

Cheers, Bertrand.
testTheGui3.C (1.73 KB)

Hi Bertrand,

sincere thanks for that.

Actually it’s not quite what I had in mind - I don’t want the quit button to have a fixed width - I want the ratios of the widths of the listbox and button to stay constant - they should both rescale as you drag the window - but I want the listbox to have a larger relative width - does this make sense?

thanks!

Hi Peter,

OK, I see. This is easy. Just take a look at the (modified) example in attachment.

Cheers, Bertrand.
testTheGui4.C (2.12 KB)

Thanks! Will give it a go when I get back from vacation