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

chen li chen_li3 at yahoo.com
Sat Nov 1 18:12:28 EDT 2008


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







      


More information about the fxruby-users mailing list