Hi list
I have build a small application, like it is shown in the header.rb example.
But I want do change the amount of the child of the FXHorizontalFrame.
This child are FXList''s. I want to remove some of this list while the
program is running.
That for I iterate through the FXHorizontalFrame and calls .destroy for
each one.
Look at the function : clearAll
But it seems not working.
Can any one of you say me the best way of solving my problem?
Alexander
code:
----
class HeaderList < FXScrollWindow
attr_reader :colors, :lists, :header
def initialize(parent, opts=0, x=0, y=0, width=0, height=0)#,
padLeft=DEFAULT_SPACING, padRight=DEFAULT_SPACING,
padTop=DEFAULT_SPACING, padBottom=DEFAULT_SPACING,
hSpacing=DEFAULT_SPACING, vSpacing=DEFAULT_SPACING)
super(parent,opts|SCROLLERS_NORMAL,x,y,width,height)#,padLeft,padRight,padTop,padBottom,hSpacing,vSpacing)
@lists = []
@packer=FXPacker.new(self,LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0,
0,0,0,0, 0,0)
@header = FXHeader.new(@packer,nil,0,HEADER_RESIZE)
@header.connect(SEL_CHANGED) { |sender, sel, which|
@lists[which].width = @header.getItemSize(which)
}
@content = FXHorizontalFrame.new(@packer,
LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0, 0,0)
@colors=[FXRGB(255,240,240),FXRGB(240,255,240),FXRGB(240, 240, 255)]
@actC = 0
end
def addRow(text,icon=nil,size=0,data=nil,notify=false)
item = FXHeaderItem.new(text,icon,size,data)
@header.appendItem(item,notify)
(size == 0)? (siz = item.getWidth(@header)) : (siz = size)
list = FXList.new(@content,nil,0,
LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH,0,0,siz,0)
list.backColor = @colors[@actC]
@actC = (@actC+1)%@colors.length()
@lists.push(list)
end
def appendItemTo(index,text,icon=nil,data=nil,notify=false)
@lists[index].appendItem(text,icon,data,notify)
end
def clearAll()
@header.clearItems()
@lists.clear()
@content.each_child{|list|
list.destroy
}
#@content.destroy
puts @content.numChildren
end
end