Notifications
Clear all

[Closed] Mass assigning button.caption

Hi,

my first question is, why a function cannot access User Interface Items? Or I’m doing something wrong with:

(

global textvar = "Press Me"
	
	rollout MyRollout "xyz"
	(
	button bTest "Testbutton"
	)

	fn test =
	(
	bTest.caption = textvar
	)

test()

createdialog MyRollout

)

?

My real problem is that i want assign over 80 buttons a name on a mouseclick. How can this be done?

2 Replies

You can access the button from the function like this:

(
textvar = "Press Me"
	
rollout MyRollout "xyz"
	(
	button bTest "Testbutton"
	)

fn test =
	(
	MyRollout.bTest.caption = textvar
	)

test()

createdialog MyRollout
)

You can also put the function itself inside the rollout, like so:


(
textvar = "Press Me"
	
	rollout MyRollout "xyz"
		(
		button bTest "Testbutton"
			
		fn test =
			(
			bTest.caption = textvar
			)
			
		on myRollout open do test()
		)

createdialog MyRollout
)

Hi labbejason,

many thanks. Your second solution works great for me!