Forum: wxRuby Sizers + StaticText

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
829981a0591df27faa07a00d3ddd7ce7?d=identicon&s=25 Daniel S. (Guest)
on 2012-09-22 17:39
I've got some Problems with sizers and StaticTexts.

My Code:

@sizer =
@sizer.add_item(, -1, "Test"), flag: ALIGN_CENTRE)

Until here, everything is OK, Text appears on screen at the right place.

Now i want to remove this Text and replace it with two others. For this
do the following:

@sizer.add_item(, -1, "Min"), flag: ALIGN_CENTRE)
@sizer.add_item(, -1, "Max"), flag: ALIGN_CENTRE)

Now "Min" and "Max" appear at the right place (Min at the place of
"Test" and "Max" under it), but the old Text "Test" is still in place
and "behind" "Min" visible.

What am i doing wrong? Any ideas?
Alex F. (Guest)
on 2012-09-24 00:09
(Received via mailing list)

On 22/09/2012 16:39, Daniel S. wrote:
> @sizer.remove(0)
> @sizer.layout()
> @sizer.add_item(, -1, "Min"), flag: ALIGN_CENTRE)
> @sizer.add_item(, -1, "Max"), flag: ALIGN_CENTRE)

I haven't tried, but - you might try calling destroy() on the StaticText
you're deleting. In wxRuby you don't usually need to call this but here
it might be appropriate:

And usually, layout() is called after you have finished doing all
changes to the contents of a Sizer.

This topic is locked and can not be replied to.