Forum: Ruby help with FXDialogBox

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Afabd225e57b433553138fead5a820d4?d=identicon&s=25 Raj Sahae (rajsahae)
on 2007-03-03 04:49
(Received via mailing list)
I want a DialogBox where I can click a button, perform some operation,
possibly returning a value, and then the DialogBox should close (not
hide, close).  The methods I have tried for this have failed.  My
current setup, which gives me a seg fault, is:

button = FXButton.new(parent, text, icon, nil, nil, 0, . . .)
button.connect(SEL_COMMAND) do |sender, sel, data|
     self.download(card)
     self.handle(sender, ID_ACCEPT, data)
end

I also tried
button = FXButton.new(parent, text, icon, nil, self, ID_ACCEPT . . .)
button.connect(SEL_COMMAND) do
    self.download(card)
end

I can't get either of these to work.  What information am I missing
here?

Raj
Afabd225e57b433553138fead5a820d4?d=identicon&s=25 Raj Sahae (rajsahae)
on 2007-03-03 04:55
(Received via mailing list)
Raj Sahae wrote:
>
>
I fixed a typo in the code
Afabd225e57b433553138fead5a820d4?d=identicon&s=25 Raj Sahae (rajsahae)
on 2007-03-03 06:11
(Received via mailing list)
Raj Sahae wrote:
>> end
>> Raj
My latest attempt, failure once more, is the following:

FXButton.new(rows[index/CPR], nil , icon, self, ID_ACCEPT,
    LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|BUTTON_NORMAL, 0,0, WIDTH,
HEIGHT) do |button|
    button.connect(SEL_COMMAND) { self.download(card) }
end
Afabd225e57b433553138fead5a820d4?d=identicon&s=25 Raj Sahae (rajsahae)
on 2007-03-03 19:02
(Received via mailing list)
Raj Sahae wrote:
>>>     self.handle(sender, ID_ACCEPT, data)
>>>
>
Nobody on this one?
Lyle, you around somewhere?
Afabd225e57b433553138fead5a820d4?d=identicon&s=25 Raj Sahae (rajsahae)
on 2007-03-03 20:37
(Received via mailing list)
> Nobody on this one?
> Lyle, you around somewhere?
>
Ok I gave up doing it with a DialogBox and now I'm just using another
FXMainWindow
0276239ca57aee241d4b41379587fa20?d=identicon&s=25 Lyle Johnson (Guest)
on 2007-03-05 06:20
(Received via mailing list)
On 2007-03-02 21:48:39 -0600, Raj Sahae <rajsahae@gmail.com> said:

> I want a DialogBox where I can click a button, perform some operation,
> possibly returning a value, and then the DialogBox should close (not
> hide, close).  The methods I have tried for this have failed.  My
> current setup, which gives me a seg fault, is:
>
> button = FXButton.new(parent, text, icon, nil, nil, 0, . . .)
> button.connect(SEL_COMMAND) do |sender, sel, data|
>      self.download(card)
>      self.handle(sender, ID_ACCEPT, data)
> end

I don't know what "self" refers to in this context, but for the moment
I'll assume that it is the dialog box itself. In that case, you were
close; the call to FXDialogBox#handle should have looked like this:

  dialog_box.handle(button, FXSEL(SEL_COMMAND, FXDialogBox::ID_ACCEPT),
nil)

Hope this helps,

Lyle

P.S. Please post these questions to the fxruby-users mailing list for a
quicker response. I'm not able to check ruby-talk nearly as frequently
(or as thoroughly) as I used to.
This topic is locked and can not be replied to.