activating button in script from script

I have smpile problem but none of my ideas won't work.
How to activate button(make it execute) in my rollout by another buttion.
Bellow example, btn6 should activate btn5, I already try with .checked=true, state=true, enabled= true but it don't work and I have to press and execute button:

rollout unnamedRollout "Untitled" width:162 height:300
(
button btn5 "messagebox" pos:[28,28] width:90 height:30
button btn6 "accesor" pos:[36,79] width:84 height:38
on btn5 pressed do
(

messagebox "it work"

)
on btn6 pressed do
(
UIAccessor.PressButton btn5 -- press the button
)
)
createdialog unnamedRollout

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kredka's picture

Thank You

Great, thank You, work perfect.

barigazy's picture

...

Most important thing here is to declare your tool variable as global

global unnamedRollout
-- close tool if is alreday opened
try(destroyDialog unnamedRollout)catch()

or in one line with "::"

try(destroyDialog ::unnamedRollout)catch()

Now your code need to look like this

try(destroyDialog ::unnamedRollout)catch()
rollout unnamedRollout "Untitled" width:162 height:300
(
	button btn5 "messagebox" pos:[28,28] width:90 height:30
	button btn6 "accesor" pos:[36,79] width:84 height:38
	on btn5 pressed do
	(
		messagebox "it work"
	)
	on btn6 pressed do
	(
		unnamedRollout.btn5.pressed() -- press the button
	)
)
createdialog unnamedRollout 162 300 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Rodman's picture

*

What do you want to achieve with this ?

Rodman

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.