Hi,
How can I have variables sent to a text field in a dialog rarther than the standerd pop up message used by MS?
This is so I can give the user feed back through the dialog ive made.
Cheers.
Using a dialog text field to output messages
Moderators: Dorian (MJT support), JRL
Here is a sample dialog with a message in a variable being displayed four different ways. As a label, in an edit box, in a button and in a memo box. The edit box and memo box will require a ResetDialogAction to force the display of the reset dialog1.msedit1 and dialog1.msmemo1 variables. The label and button only require a GetDialogAction though they will also reset with a ResetDialogAction.
Usually I simply use a label. Buttons are nice because they display a nice border and the text will automatically center itself within the button borders. One problem with an edit or memo box is that they are editable. One nice thing about a memo box is that text will automatically wrap. To wrap text in a label or button you must explicitly place a carriage return and line feed %CRLF% in the line in the position where the line should wrap.
Hope this is helpful.
Usually I simply use a label. Buttons are nice because they display a nice border and the text will automatically center itself within the button borders. One problem with an edit or memo box is that they are editable. One nice thing about a memo box is that text will automatically wrap. To wrap text in a label or button you must explicitly place a carriage return and line feed %CRLF% in the line in the position where the line should wrap.
Hope this is helpful.
Code: Select all
Dialog>Dialog1
Caption=Dialog Message
Width=445
Height=303
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label= ,24,16
Edit=msEdit1,24,40,393,
Button= ,24,80,393,41,3
Memo=msMemo1,24,136,105,89,
EndDialog>Dialog1
Show>dialog1
Let>Message=Select the "X" to close this window
Let>dialog1.mslabel1=%Message%
Let>dialog1.msedit1=%Message%
Let>dialog1.msbutton1=%Message%
Let>dialog1.msmemo1=%Message%
ResetDialogAction>dialog1
Label>Loop
GetDialogAction>dialog1,res1
If>res1=2,EOF
Goto>Loop
Label>EOF
Great example and explanation JRL, thanks for posting this.
To show how things would look with a variable that grows over time, I added a few lines to demo this... adding in %CRLF% every 40 chars for the label and button.
If the variable to display is a growing string, the memo box with its auto-wrapping looks like a good choice.
To show how things would look with a variable that grows over time, I added a few lines to demo this... adding in %CRLF% every 40 chars for the label and button.
Code: Select all
Dialog>Dialog1
Caption=Dialog Message
Width=445
Height=303
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label= ,24,16
Edit=msEdit1,24,40,393,
Button= ,24,80,393,41,3
Memo=msMemo1,24,136,105,89,
EndDialog>Dialog1
Show>dialog1
Let>Message=Select the "X" to close this window
Let>dialog1.mslabel1=%Message%
Let>dialog1.msedit1=%Message%
Let>dialog1.msbutton1=%Message%
Let>dialog1.msmemo1=%Message%
Length>Message,char_length
Let>char_length_to_wrap_at=40
Label>Loop
ResetDialogAction>dialog1
//Label>Loop
GetDialogAction>dialog1,res1
If>res1=2,EOF
ConCat>Message,.
Let>char_length=char_length+1
ConCat>dialog1.msedit1,.
ConCat>dialog1.msmemo1,.
If>char_length=char_length_to_wrap_at
Let>char_length=0
ConCat>dialog1.mslabel1,%CRLF%
ConCat>dialog1.msbutton1,%CRLF%
ELSE
ConCat>dialog1.mslabel1,.
ConCat>dialog1.msbutton1,.
ENDIF
Wait>0.25
Goto>Loop
Label>EOF
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -