RE: [Fxruby-users] FXPopup questions
Status: Inactive
Brought to you by:
lyle
|
From: Oliver S. <ol...@mo...> - 2004-05-17 17:44:58
|
> 1. How can I remove all items from a FXPopup? I've tried destroying
> its children, but then I get empty menu items:
>
> myPopup.children.each { | option |
> option.destroy
> }
You should probably use 'myPopup.removeChild(child)'. I believe the destroy
function is always handled by Fox or FXRuby internally, so you don't ever
need to call it. Watch out for 'children.each', though...the iterator can
screw up when you remove a child from the array in the middle of recursing
through it. You may want to duplicate the array first.
> 2. I am able to add new FXOption items to the popup:
>
> opt = FXOption.new(myPopup, ...)
> opt.create()
>
> Now I'd like to choose which one is selected. How can I do that?
I'm not sure what FXOption/FXOptionMenu are...I thought FXOption was a radio
button at first, but now it looks like something else. If what you want is
a radio button in a menu; i.e. you have a few options and the selected one
has a little circle next to it, you should do:
opt = FXMenuCommand.new(myPopup, "a fun radio button")
opt.checkRadio
It looks like you have to manually uncheck the other options:
opt.connect(SEL_COMMAND) { |sender, message, data|
# uncheck other options here with uncheckRadio...
sender.checkRadio
}
So I guess I don't know what FXOption is, but the sample program dialog.rb
seems to use it, if that helps.
-- Oliver
|