Kurt Dresner wrote:> If I have a panel that contains a sizer that contains, for example,
> some number of gauges, and I want to add another gauge on-the-fly, can
> I do that?
>
> Every time I try modifying things at run-time, it just messes everything
up.
I have also had some trouble with this. Wx, it seems, has a somewhat
static mindset. However, there are a couple thing you can try.
First, and simplest, would be to add all the possible widgets that you
might want, but hide and show them as necessary. I haven''t done much of
this, but hopefully it would work.
The other approach is similar to what I did with the calendar sample in
wxruby-swig. The calendar app in wxruby tries to change a window style
on the fly...and it doesn''t really work correctly. It took me quite a
bit of experimenting to find something that works reasonably well.
You can see the whole app here, but keep in mind that it will not run
under wxruby 0.4 without some changes:
http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/wxruby-swig/samples/calendar/calendar.rb?rev=1.2&cvsroot=wxruby&content-type=text/vnd.viewcvs-markup
Sorry about the long url. You can find it yourself by going to the
wxruby project on rubyforge, cvs, wxruby-swig, samples, calendar.
The interesting bit is in the toggle_cal_style(on,flag) method.
Kevin