[fxruby-users] Dynamic generation of a (sub) layout

Armin Armbruster aarmbruster at ndigital.com
Fri Nov 21 16:59:58 EST 2008


first of all - I'm relatively unexpierienced with GUI programming in general
and with FXRuby in particular.
I've managed to write a little FXRuby app that animates some data I've
collected. I made really good progress for a while, but now I'm stuck with
the following problem.

My data is read from file and can have a varying number of elements,
depending on the file.
I want to be able to turn on and off each of the elements individually by
means of check-buttons.
I therefore created a frame that contains a matrix of check-buttons, one for
each element. This frame therefore has to be recreated every time a new file
gets loaded.

Below is a simplified version of what I've been trying to do.
At the moment the layout works fine the first time around (currently I've
hard-coded to load a specific file at startup, this will change later).
However when I try to open another file, the content of @selectUVFrame
disappears - nothing is displayed. I've inspected the children of
@selectUVFrame and they all seem to be there, except I can't see them. If I
leave out the first line (	@selectUVFrame.each_child{|c|
@selectUVFrame.removeChild(c)}) the list of children of @selectUVFrame
grows, but again I can't see the new ones (and the layout get's corrupted,

I seem to miss some basic understanding here and couldn't find any hint of
what I'm doing wrong.

Thanks for any help,

@selectUVFrame is of type FXVerticalFrame and is itself a child of another

def generateUVSelectors
	@selectUVFrame.each_child{|c| @selectUVFrame.removeChild(c)}

	FXButton.new(@selectUVFrame, "&Clear All", nil, nil,
	  @selectedUVs.each{|cb| cb.setCheck(false)}

	FXButton.new(@selectUVFrame, "&Set All", nil, nil, 0).connect(SEL_COMMAND){
	  @selectedUVs.each{|cb| cb.setCheck(true)}

	selectMatrix = FXMatrix.new(@selectUVFrame, 4, MATRIX_BY_COLUMNS)
	@selectedUVs = []

		@selectedUVs << FXCheckButton.new(selectMatrix, i.to_s, nil, 0){ |cb|
		@selectedUVs[-1].connect(SEL_COMMAND, method(:onSelectUV))
View this message in context: http://www.nabble.com/Dynamic-generation-of-a-%28sub%29-layout-tp20630230p20630230.html
Sent from the FXRuby Users mailing list archive at Nabble.com.

More information about the fxruby-users mailing list