How to change the name of a Button in a dialog?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Kwhiz
Junior Coder
Posts: 35
Joined: Wed Jan 12, 2005 6:19 pm

How to change the name of a Button in a dialog?

Post by Kwhiz » Sat Nov 12, 2005 10:04 pm

.
Is it possible to change the name of a non-modal dialog button while the dialog is showing on the screen? For example, you could start your script with

let>k=red

And then in your dialog creation you could set the button to

Button=k,10,10,50,40,5

The word 'red' will now appear on the button. Now you can use the ShowDialog command to show the dialog on your screen. Then you can change the value of k to 'blue' later in your script. But at this point is there some way of updating the dialog without closing it? Remember, the dialog is already showing on my screen at this point, and the button says 'red'. I want to change it to 'blue' without closing the dialog. Is this possible?

Thank you,
Kwhiz

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sat Nov 12, 2005 10:23 pm

Hi,

Yes. Refer to the button caption with DialogName.msButton0 where 0 is the zero based index of the button. Run this script and you will see after 2 seconds the name of the button change from red to blue:

Dialog>Dialog1
Caption=Dialog1
Width=445
Height=250
Top=188
Left=181
Button=Red,24,56,75,25,0
Button=OK,24,96,75,25,0
EndDialog>Dialog1

Show>Dialog1
Wait>2
Let>Dialog1.msbutton0=Blue
ResetDialogAction>Dialog1
Wait>5

If you step through with the debugger and the watch list open you can see the button caption variables in the watch list (Dialog1.msButton0).
MJT Net Support
[email protected]

Kwhiz
Junior Coder
Posts: 35
Joined: Wed Jan 12, 2005 6:19 pm

Post by Kwhiz » Sun Nov 13, 2005 2:16 am

Oh, great! Thanks alot!
Kwhiz

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts