[fxruby-users] how to change a button's text one by one

Soumyanath soumyanath.c at gmail.com
Sun Nov 2 09:16:01 EST 2008


Hi Chen,

I suggest you use timer to show the text.

chen li wrote:
> Hi all,
> 
> 
> I create 3 buttons.  If I click @button_start , at button_word will change its text one by one based on an array. If I click @button_end the program will end. My problem here is that  the word on @button_word doesn't change one by one, instead they all show up at the same time.
> 
> Any idea?
> 
> 
> Thanks,
> 
> Li 
> 
>  
> ###################################################
> #create 3 buttons
> @button_start=FXButton.new(self,'start')
> @button_end=FXButton.new(self,'end')
> @button_word=FXButton.new(self,'reading words')
> 
> # change the text on @button_word one by one
> slice=%w{A,B,C,D,E}
> 
> @button_start.connect(SEL_COMMAND) do|sender,selector,data|
> 	slice.each  do |letter|
> 		@button_word.text=letter
> 		sleep 2
> 	end
> 		
> end
> 
> 
> 
> 
> 		
> @button_end.connect(SEL_COMMAND) do|sender,selector,data|
> 	exit
> 		
> end


-- 
Regards

Soumyanath Chatterjee
[http://www.soumya.name]

Question _your own_ authority.



More information about the fxruby-users mailing list