dialog-width / empty cells in FlexGridSizer

hello,

I'm creating a universal multi-line dialog,
consisting of a helptext, followed by a number of lines,
where each user input line consists of
- name = statictext
- value = textctrl
- empty or bitmapbutton (depending on the type of user information)
see the example in img5.png

Although it's now working as desired,
I'm doing some weird things, that might be done in a better way.
The code is shown in ing6.png.

1. SetSize of elements after creating them doesn't seem to work,
so to define a minimum width of the textctrl's,
I specify the width at creation time: line 113.
(and this width might be overruled if the helptext at the top is wider, which is desired)
Is there a better way to achieve this ?

2. if I don't need a button in the third column, I add a empty statictext instead: line 121,122
Again is there a better way to achieve this ?

thanks,
Stef Mientki

img6.png

img5.png

Stef Mientki wrote:

hello,

I'm creating a universal multi-line dialog,
consisting of a helptext, followed by a number of lines,
where each user input line consists of
- name = statictext
- value = textctrl
- empty or bitmapbutton (depending on the type of user information)
see the example in img5.png

Although it's now working as desired,
I'm doing some weird things, that might be done in a better way.
The code is shown in ing6.png.

1. SetSize of elements after creating them doesn't seem to work,
so to define a minimum width of the textctrl's,
I specify the width at creation time: line 113.
(and this width might be overruled if the helptext at the top is wider, which is desired)
Is there a better way to achieve this ?

You can use SetMinSize after the widget is created. The Sizers look at the min size and then the best size when deciding what to do for layout. When you pass a size to the widget's constructor it normally not only sets the actual size, but also sets the min size.

2. if I don't need a button in the third column, I add a empty statictext instead: line 121,122
Again is there a better way to achieve this ?

Use a spacer instead. A spacer is simply what you get when you add a size tuple or a wx.Size object to a sizer.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!