Hi,
I've included a short code example exhibiting this 'illegal icon specified'
error.
What I'm trying to do here is pretty simple. I have a FXTreeList that I
want to
wipe clean and populate with new FXTreeListItems. It works fine until the
new
tree list item has an icon (closed or open state) different from the icon
that was
displayed for the original tree list item. Then I get the error I wrote in
the
subject of this note.
Does anyone see what I'm doing wrong here? I'm running Andy's 1.6.5 Windows
distribution and FXRuby 0.99.188 supplied by Lyle. I am willing to upgrade
if
that will solve this problem.
Any help would be appreciated.
Regards,
Barry
----8<-----------8<-------------------------------------------
require 'fox'
include Fox
class TreeChecker < FXMainWindow
attr_accessor :called_tree, :icon1, :icon2
def make_icon(name)
FXGIFIcon.new(getApp(), File.open(File.join("icons", name), "rb").read)
end
def initialize(app)
# Call the base class initializer first
super(app, "Clean out tree and Add new tree items", nil, nil, DECOR_ALL,
0, 0, 200, 200)
@icon1 = make_icon("minifolderopen.gif")
@icon2 = make_icon("minifolder.gif")
contents = FXVerticalFrame.new(self,
LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
@called_tree = FXTreeList.new(contents, 0, nil, 0,
(TREELIST_BROWSESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|
TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y))
@called_tree.addItemLast(nil,"original item1",@icon2,@icon2)
treeChanger = FXButton.new(contents, "Change Tree")
treeChanger.connect(SEL_COMMAND) { |sender, sel, checked|
@called_tree.clearItems
newitem = @called_tree.addItemLast(nil,"new item1",@icon1,@icon1) #
error
}
end
def create
super
show(PLACEMENT_SCREEN)
end
end
def run
# Make application
application = FXApp.new("TreeChecker", "Tree Checker")
# Open display
application.init(ARGV)
# Make window
m = TreeChecker.new(application)
# Create app
application.create
# Run
application.run
end
run