General Macro Scheduler discussion
Moderators: Dorian (MJT support), JRL
-
armsys
- Automation Wizard
- Posts: 1108
- Joined: Wed Dec 04, 2002 10:28 am
- Location: Hong Kong
Post
by armsys » Sun Jan 16, 2011 12:11 am
The following code runs fine except the label shows: %Dialog1.msLabel1% instead of 'Choose a list' as defined in Caption.
Please help. Thanks.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 315
Top = 95
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Test List'
ClientHeight = 52
ClientWidth = 194
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object msLabel1: TLabel
Left = 5
Top = 5
Width = 61
Height = 13
Caption = 'Choose a list'
Transparent = True
end
object msComboBox1: tMSComboBox
Left = 5
Top = 20
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 8
Text = 'Select one'
Items.Strings = (
'Item 1'
'Item 2'
'Item 3'
'Item 4'
'Item 5')
ListText = 'Item 1'#13#10'Item 2'#13#10'Item 3'#13#10'Item 4'#13#10'Item 5'#13#10
end
object msButton1: tMSButton
Left = 152
Top = 18
Width = 33
Height = 25
Caption = 'OK'
DoubleBuffered = True
ModalResult = 22
ParentDoubleBuffered = False
ParentShowHint = False
ShowHint = False
TabOrder = 9
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
Last edited by
armsys on Tue Jan 18, 2011 12:38 pm, edited 1 time in total.
-
Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Sun Jan 16, 2011 5:16 pm
For me it shows "Choose a list".
-
jpuziano
- Automation Wizard
- Posts: 1085
- Joined: Sat Oct 30, 2004 12:00 am
Post
by jpuziano » Sun Jan 16, 2011 8:32 pm
mtettmar wrote:For me it shows "Choose a list".
I get the same result as Marcus using MS 12.1.3 running on XP SP3.
What MS version and OS are you running?
You only posted the Dialog, maybe something else in your code is causing the problem. If you would like to post a more complete script (with a Show>Dialog1 line. etc.) that displays the problem, that might help.
-
armsys
- Automation Wizard
- Posts: 1108
- Joined: Wed Dec 04, 2002 10:28 am
- Location: Hong Kong
Post
by armsys » Sun Jan 16, 2011 11:14 pm
Hi mtettmar & jpuziano,
Sorry. It's my fault. Your result is correct. I should have tested a partial script before posting. The whole script:
Code: Select all
//the dialog with the combo box and the query button
/*
Dialog>Dialog1
Caption=Test Dialog
Width=210
Height=90
Top=116
Left=20
ComboBox=msComboBox1,5,20,145,Item 1%CRLF%Item 2%CRLF%Item 3%CRLF%Item 4%CRLF%Item 5
Button=OK,152,18,33,25,22
Label=Choose a list,5,5,true
EndDialog>Dialog1
*/
Dialog>Dialog1
object Dialog1: TForm
Left = 315
Top = 95
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Test List'
ClientHeight = 52
ClientWidth = 194
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object msLabel1: TLabel
Left = 5
Top = 5
Width = 61
Height = 13
Caption = 'Choose a list'
Transparent = True
end
object msComboBox1: tMSComboBox
Left = 5
Top = 20
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 8
Text = 'Select one'
Items.Strings = (
'Item 1'
'Item 2'
'Item 3'
'Item 4'
'Item 5')
ListText = 'Item 1'#13#10'Item 2'#13#10'Item 3'#13#10'Item 4'#13#10'Item 5'#13#10
end
object msButton1: tMSButton
Left = 152
Top = 18
Width = 33
Height = 25
Caption = 'OK'
DoubleBuffered = True
ModalResult = 22
ParentDoubleBuffered = False
ParentShowHint = False
ShowHint = False
TabOrder = 9
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
show>dialog1
//this loop runs and waits for you to press the button
label>actionloop
Getdialogaction>dialog1,r
wait>.2
//When the button is pressed it sets the results value or "r" to 22 and runs the subroutine
if>r=22
gosub>combovaluelookup
endif
goto>actionloop
srt>combovaluelookup
resetdialogaction>dialog1
//this command is what pulls all the values from the dialog and in this case whatever you chose from the combobox
getdialogaction>dialog1,r
//this is an example of how you can use the value you pulled
messagemodal>The item you chose was %dialog1.mscombobox1%
//This is another useful variable, the entire list of values that are in the combobox
messagemodal>The entire list of items is %CRLF%%Dialog1.Mscombobox1.items.text%
END>combovaluelookup
Running the whole (original) script still displays "%Dialog1.msLabel1%".
How is "Choose a list" changed to "%Dialog1.msLabel1%"?
Thanks for your help.
[/code]
-
jpuziano
- Automation Wizard
- Posts: 1085
- Joined: Sat Oct 30, 2004 12:00 am
Post
by jpuziano » Mon Jan 17, 2011 12:49 am
Hi armsys,
Well yes, now I am seeing the same failure as you are seeing... however why are you using
GetDialogAction> and
ResetDialogAction> with a v12 dialog? These commands only work with older dialogs... check out what the Help File has to say:
Help File wrote:GetDialogAction>DialogName,Result
Not supported in Macro Scheduler Lite.
Deprecated. Supported only for backward compatibility. Works only with old-style Dialog Blocks (v11 and earlier).
If you stick with a v11 dialog, I expect your code will work.
If you want to move on to use the new v12 dialogs, learn how to use
AddDialogHandler> instead.
The two videos that Marcus just provided on his blog here should get you going.
Take care
-
armsys
- Automation Wizard
- Posts: 1108
- Joined: Wed Dec 04, 2002 10:28 am
- Location: Hong Kong
Post
by armsys » Mon Jan 17, 2011 3:29 am
Hi jpuziano,
Thanks for your quick help.
Thanks for troubleshooting my code.
Your advice is absolutely helpful.