[fxruby-users] fox/fxruby message and handler

Lyle Johnson lyle at lylejohnson.name
Tue Feb 17 15:04:56 EST 2009

On Tue, Feb 17, 2009 at 1:15 PM, Andreas S <andreas_s at hotmail.com> wrote:

> I have a line in my test where I call my label's handle method:
> label = Label.new frame, "Label"
> button = FXButton.new frame, "Button"
> button.connect SEL_COMMAND do
>   label.handle button, FXSEL(SEL_COMMAND, Label::ID_FUNNY, "joke")
> end
> Shouldn't this do the trick?

No. Generally speaking, the FXLabel widget doesn't respond to SEL_COMMAND.

> I've used this approach in my code before. For example,
> in my table, I made Ctrl-A to select all cells and I did it by sending
> message to table's corner button, simulating a click (the snippet is at the end of this email,
> in case you'd like to know). I believe this is the answer you gave in an old thread I
> found when googling about simulating button click.

Right. The FXButton widget *does* respond to SEL_LEFTBUTTONPRESS and
SEL_LEFTBUTTONRELEASE messages. But it's a different widget than the
FXLabel widget. Different behavior.

> I tried to replace that Label with FXButton which will print something when
> it is clicked. It does print it when I click it, but simulating a click still doesn't do
> it.

Could we back up a step or two? What is it that you're actually trying
to accomplish? Are you trying to change the label's text whenever a
button is pressed, or what?

More information about the fxruby-users mailing list