Forum: FXRuby Dynamic Text in FXButton

56c8db2891b2d2714ff22be005859285?d=identicon&s=25 Alex DeCaria (deke)
on 2008-07-20 21:47
Is there a way to have the text in a button change when you press the
button?  For example, a button that says "Hi", and when you click it
says "Bye".  I can't find how to do this.

Thanks,

Alex
75028017b8cda7d95d09cb4ce26aeba2?d=identicon&s=25 Mateusz Tybura (wujciol)
on 2008-08-02 12:28
Alex DeCaria wrote:
> Is there a way to have the text in a button change when you press the
> button?  For example, a button that says "Hi", and when you click it
> says "Bye".  I can't find how to do this.
>
> Thanks,
>
> Alex

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

require 'fox16'

include Fox

app = FXApp.new

mw= FXMainWindow.new(app, "Hello ",:width => 320, :height => 240)

button = FXButton.new(mw,"Hey")
button.connect(SEL_COMMAND) do
  button.text = "Bye"
end

app.create

mw.show(Fox::PLACEMENT_SCREEN)

app.run
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: http://getfiregpg.org

iD8DBQFIlDbBDbyapJB9FLwRAiR+AJ9xhftoZEX/pJZ+/Vf8X3BIZERrIwCbBdu9
YuoycBuIRg5lH6ByTdk61Ck=
=qOm9
-----END PGP SIGNATURE-----
This topic is locked and can not be replied to.