[fxruby-users] FxRuby

Lyle Johnson lyle.johnson at gmail.com
Tue Dec 4 12:16:11 EST 2007

On Dec 4, 2007, at 9:58 AM, Ernst Tanaka wrote:

> I have managed to build a demo screen with FoxGui (see below), but  
> I am
> struggling to write a program that handles this window.
> Let the program handle the following actions.
> At Init move value '1' to button one, '2' to button '2' and '3' to
> button '3', 'a' to text1, 'b' to text2 and 'c' to text3.

The code is difficult to follow because (1) it was automatically  
generated and (2) it uses a lot of non-standard APIs. If you're  
asking how to change the label text for an FXButton or FXTextField  
widget, however, you can use:

	@button1.text = "1"
	@button2.text = "2"
	@button3.text = "3"
	@text1.text = "a"
	@text2.text = "b"
	@text3.text = "c"

> On click of button1. Swap the strings from button2 and button3 and  
> text2
> and text3.

	@button1.connect(SEL_COMMAND) do
		tmp = @button2.text
		@button2.text = @button3.text
		@button3.text = tmp
		tmp = @text2.text
		@text2.text = @text3.text
		@text3.text = tmp

> On click of button2. swap the strings from button1 and button3 plus
> text1 and text3.

	@button2.connect(SEL_COMMAND) do
		tmp = @button1.text
		@button1.text = @button3.text
		@button3.text = tmp
		tmp = @text1.text
		@text1.text = @text3.text
		@text3.text = tmp

> On click of button3. swap 1 and 2.

	@button3.connect(SEL_COMMAND) do
		tmp = @button1.text
		@button1.text = @button2.text
		@button2.text = tmp
		tmp = @text1.text
		@text1.text = @text2.text
		@text2.text = tmp

> A picture is worth a 1000 words equals to an example hold the value  
> of a
> book.

Keep your feet on the ground, but keeping reaching for the stars.

> Thanks a million in advance.

Hope this helps,


More information about the fxruby-users mailing list