PDA

View Full Version : Mass assigning button.caption


Posativ
04-11-2008, 05:05 PM
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?

labbejason
04-11-2008, 05:25 PM
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
)

Posativ
04-11-2008, 05:34 PM
Hi labbejason,

many thanks. Your second solution works great for me!

CGTalk Moderation
04-11-2008, 05:34 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.