Re: [Fxruby-users] Treelist -- can't add new items with data.
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <jl...@cf...> - 2003-08-13 21:18:30
|
Hugh Sasse Staff Elec Eng wrote: > I have a tree list, which is supposed to hold a cross platform > directory structure: thus it maps names with spaces onto numbers > expressed as base 36 codes. When I add a name on its own, I can add > to the tree, but if I put the data in, the item doesn't get added to > the tree. I've missed something, but I've been staring at this so > long I can't see what it is. The thing isn't happening when the > "add category" button is pressed. The crucial code is here. <snip> > I know that an item is selected, because when I had bugs in that > branch of the code the thing crashed. Do I need to fire off some > kind of event, or something, to see the change to the tree? When I > just did treelist.additem(treelist.current, "name") name got added. OK, so you are /sure/ that it's getting inside the if-check inside the SEL_COMMAND handler for @add_cat_btn? @add_cat_btn.connect(SEL_COMMAND) { # collect info from dialog box unless result.zero? if treelist.currentItem puts "Yes, I am here!" @treeview[path] = treelist.addItemLast(...) end end } If we've confirmed that, please see what happens if you add a call to FXTreeList#recalc immediately following that: @treeview[path] = treelist.addItemLast(...) treelist.recalc Calling recalc() marks a widget's layout as "dirty", meaning it nudges the parent layout manager to recalculate the layout for that widget and its siblings. At first glance, I don't see why this should be necessary, and so I'm skeptical that it's going to make a difference. But I've been wrong before ;) If that doesn't work, let me know if you'd like me to take a closer look at the code. Hope this helps, Lyle |