Help with Dialog ComboBox
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Help with Dialog ComboBox
I'm trying to use this new MSComboBox feature in one of my dialog box but can't find any info in the help file or on the forum.
object MSComboBox1: tMSComboBox
I need to know what the ListText limits are?
I seems like there's a 11 item limit!
If this is the case is there a work around?
I have 11 fields in my dialog box that would have more then 11 items in them.
Please point me in the right direction
Gil
object MSComboBox1: tMSComboBox
I need to know what the ListText limits are?
I seems like there's a 11 item limit!
If this is the case is there a work around?
I have 11 fields in my dialog box that would have more then 11 items in them.
Please point me in the right direction
Gil
Hi Gil
Below is a combobox sample I wrote a while back intending to submit it as a sample script. The list only contains a few items. To test your 11 item limit theory I copied and pasted the items over and over until there were a couple of hundred in the list and the combobox seemed to display them all. I didn't actually count them but there were certainly more than 11.
Let us know if this helps.
Dick
Below is a combobox sample I wrote a while back intending to submit it as a sample script. The list only contains a few items. To test your 11 item limit theory I copied and pasted the items over and over until there were a couple of hundred in the list and the combobox seemed to display them all. I didn't actually count them but there were certainly more than 11.
Let us know if this helps.
Dick
Code: Select all
//List of values to display in Combo Box separated by carriage return / line feed
Let>CBList=eggs%crlf%bread%crlf%milk%crlf%carrots%crlf%apples%crlf%
//Combo Box property "Text" is set to
//the initial Combo Box display text
Dialog>Dialog1
object Dialog1: TForm
Left = 277
Top = 243
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 173
ClientWidth = 267
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poMainFormCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object MSComboBox1: tMSComboBox
Left = 60
Top = 22
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 0
Text = 'Make a Selection'
end
object MSButton1: tMSButton
Left = 87
Top = 108
Width = 75
Height = 25
Caption = 'Ok'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 1
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
//If the Dialog is closed quit the script
AddDialogHandler>Dialog1,,Onclose,Quit
//If the "Ok" button is picked, procees the combo box selection
AddDialogHandler>Dialog1,msButton1,Onclick,Process
//Set the combo box list text
SetDialogProperty>Dialog1,mscombobox1,listtext,CBlist
//Subroutine to end script
SRT>Quit
Exit>0
END>Quit
//Display the dialog
Show>dialog1,res1
//Subroutine to Process combo box selection
SRT>Process
GetDialogProperty>Dialog1,msComboBox1,text,value
MDL>value
CloseDialog>Dialog1
END>Process
I did the same thing, taking up the CBList variable to 50 or 60 items and they all displayed fine.
Hmmm... I wonder if there is an absolute limit to how many values you can have and if so, what it might be...
In any case, thanks for the example script JRL.
Hmmm... I wonder if there is an absolute limit to how many values you can have and if so, what it might be...
In any case, thanks for the example script JRL.
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 -
Ok... There's always a limit... But the combo box will display every file on my hard drive. All 82,916 of them.Hmmm... I wonder if there is an absolute limit to how many values you can have and if so, what it might be...
On my computer, this ran about 5 minutes before the dialog displayed. If you run this be patient.
Code: Select all
Message>Making a really long list%CRLF%This will take several minutes%CRLF%Please Wait...
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>CMD /c dir c:\*.* /a-d /b /s > %temp_dir%CdriveFileList.txt
ReadFile>%temp_dir%CdriveFileList.txt,CBList
Message>Finished prosessing the file%CRLF%Now waiting for the combo box to populate so the dialog can display...
//DeleteFile>%temp_dir%CdriveFileList.txt
//List of values to display in Combo Box separated by carriage return / line feed
//Let>CBList=eggs%crlf%bread%crlf%milk%crlf%carrots%crlf%apples%crlf%
//Combo Box property "Text" is set to
//the initial Combo Box display text
Dialog>Dialog1
object Dialog1: TForm
Left = 277
Top = 186
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 115
ClientWidth = 926
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poMainFormCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 16
Width = 54
Height = 13
Caption = 'Files on C:\'
end
object MSComboBox1: tMSComboBox
Left = 8
Top = 38
Width = 905
Height = 21
ItemHeight = 13
TabOrder = 0
Text = 'Make a Selection'
end
object MSButton1: tMSButton
Left = 839
Top = 76
Width = 75
Height = 25
Caption = 'Ok'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 1
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
//If the Dialog is closed quit the script
AddDialogHandler>Dialog1,,Onclose,Quit
//If the "Ok" button is picked, procees the combo box selection
AddDialogHandler>Dialog1,msButton1,Onclick,Process
//Set the combo box list text
SetDialogProperty>Dialog1,mscombobox1,listtext,CBlist
//Subroutine to end script
SRT>Quit
Exit>0
END>Quit
CloseWindow>Macro Scheduler Message
//Display the dialog
Show>dialog1,res1
//Subroutine to Process combo box selection
SRT>Process
GetDialogProperty>Dialog1,msComboBox1,text,value
MDL>value
CloseDialog>Dialog1
END>Process
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Thanks for your responses guys!
I was using the Property for MSComboBox1 >
"ListText" > MulitiLine Edit popup to add items to my ComboBox list.
This is where I hit the 11 item limit.
I can't seem to find any real documentation on what all the properties options do, I assumed
this was where the list of items would go.
I tried add to both lists (Items.String) and (ListText) manually but received error messages
Thanks for your help
Gil
I was using the Property for MSComboBox1 >
"ListText" > MulitiLine Edit popup to add items to my ComboBox list.
This is where I hit the 11 item limit.
I can't seem to find any real documentation on what all the properties options do, I assumed
this was where the list of items would go.
I tried add to both lists (Items.String) and (ListText) manually but received error messages
Thanks for your help
Gil
Code: Select all
object MSComboBox1: tMSComboBox
Left = 131
Top = 497
Width = 145
Height = 23
ItemHeight = 15
TabOrder = 39
Text = 'MSComboBox1'
Items.Strings = (
'BARNES INDIAN RIVER TRADIN COMPANY'
'CAUSEY FERN, INC.'
'CELSUS EXPORT LLC.'
'DIVERSIFIED CITRUS MARKETING INC.'
'DLF INTERNATIONAL, INC.'
'DNE SALES INTERNATIONAL'
'DOLE-JAPAN'
'DUDA FARM FRESH FOODS, INC.'
'FERNCO'
'GOLDEN RIVER FRUIT COMPANY'
'GOLDSPAN LTD.'
'GOO')
ListText =
'BARNES INDIAN RIVER TRADIN COMPANY'#13#10'CAUSEY FERN, INC.'#13#10'CELSUS EX' +
'PORT LLC.'#13#10'DIVERSIFIED CITRUS MARKETING INC.'#13#10'DLF INTERNATIONAL,' +
' INC.'#13#10'DNE SALES INTERNATIONAL'#13#10'DOLE-JAPAN'#13#10'DUDA FARM FRESH FOOD' +
'S, INC.'#13#10'FERNCO'#13#10'GOLDEN RIVER FRUIT COMPANY'#13#10'GOLDSPAN LTD.'#13#10'GOO'#13 +
#10
end
end
EndDialog>BoLDialog
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Help with Dialog ComboBox
Since I've had no other replies in week, should I assume that 11 is the limit
when adding item to a ComboBox using the MulitiLine Edit Box?
Regards
Gil
when adding item to a ComboBox using the MulitiLine Edit Box?
Regards
Gil
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
There's no limit to how many items you can add to a combobox. However, I see what you mean - the multi-line edit window in the property editor at *design-time* does indeed appear to have a limit, which it shouldn't.
A number of workarounds
- edit the ListText property in the code of your dialog block
- Open up Notepad and type your list into notepad. Select-All and Copy to clipboard. Then in the dialog designer in the ordinary property field (not the multi-line edit one - just click into the property field - and paste the clipboard contents).
- Or do it dynamically with code. Here's a a quick way to maintain your list easily and add it on the fly to the dialog:
And in the mean time we'll get that annoying limitation of the property editor fixed.
A number of workarounds
- edit the ListText property in the code of your dialog block
- Open up Notepad and type your list into notepad. Select-All and Copy to clipboard. Then in the dialog designer in the ordinary property field (not the multi-line edit one - just click into the property field - and paste the clipboard contents).
- Or do it dynamically with code. Here's a a quick way to maintain your list easily and add it on the fly to the dialog:
Code: Select all
LabelToVar>MyList,comboList
SetDialogProperty>Dialog1,MSComboBox1,ListText,comboList
..
Show>Dialog1,r
/*
MyList:
BARNES INDIAN RIVER TRADIN COMPANY
CAUSEY FERN, INC.
CELSUS EXPORT LLC.
DIVERSIFIED CITRUS MARKETING INC.
DLF INTERNATIONAL, INC.
DNE SALES INTERNATIONAL
DOLE-JAPAN
DUDA FARM FRESH FOODS, INC.
FERNCO
GOLDEN RIVER FRUIT COMPANY
GOLDSPAN LTD.
GOOD
ONE
YES
ANOTHER
OK
*/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Thanks Marcus...mtettmar wrote:we'll get that annoying limitation of the property editor fixed.
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 -
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Help with Dialog ComboBox
Yes! Thank you Marcus
I liked the idea of the dynamically maintaining the ComboBox list.
Because I will have 7 ComboBox's to maintain.
But as you might have guessed I have a few questions.
Can the ComboBox be renamed? Instead of using MSComboBox1.
What is the syntax for using the variable from the ComboBox.
The ComboBox list works greatbut I can’t seem to use the value as a variable.
As you can see I pausing the script to test the variable value but I keep getting %BoLDialog.ShpName% in the message box. When I step thru the code I can see
values in the other nonComboBox fields in the BolDialog.
Please shed some light on what I’m doing worng.
Here’s a sample of my sctipt
Thanks again for your help
Gil
I liked the idea of the dynamically maintaining the ComboBox list.
Because I will have 7 ComboBox's to maintain.
But as you might have guessed I have a few questions.
Can the ComboBox be renamed? Instead of using MSComboBox1.
What is the syntax for using the variable from the ComboBox.
The ComboBox list works greatbut I can’t seem to use the value as a variable.
As you can see I pausing the script to test the variable value but I keep getting %BoLDialog.ShpName% in the message box. When I step thru the code I can see
values in the other nonComboBox fields in the BolDialog.
Please shed some light on what I’m doing worng.
Here’s a sample of my sctipt
Code: Select all
object ShpName: tMSComboBox
Left = 127
Top = 5
Width = 144
Height = 23
ItemHeight = 15
TabOrder = 35
end
EndDialog>BoLDialog
SetDialogProperty>BoLDialog,ShpName,ListText,comboList
Show BoLDialog,r
/*
MyList:
BARNES
CAUSEY
CELSUS
DIVE
DLF
DNE
DUDA
GOLDEN
ONE
YES
ANOTHER
OK
*/
Include>F:\MS Sctipts\Europe\2_DialogAction.scp
Start of 2_DialogAction.scp
Label>ActionLoop
GetDialogAction>BoLDialog,r
Wait>4
message>%BoLDialog.ShpName%
Wait>9000
If>{(%BoLDialog.ShpName% = "UNITED") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE095055
EndIf
Length>BoLDialog.DDate,vLen
If>{(%vlen%=6)and(%UpdateFlag%=1)},Update
If>r=1,Update
If>r=2,Close
GoTo>ActionLoop
SRT>Update
Let>UpdateFlag=0
Let>BoLDialog.SrvContract=%SrvContNum%
ResetDialogAction>BoLDialog
END>Update
Label>Close
CloseDialog>BoLDialog
Gil
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, you can call a combo box what you like. Change the Name property in the property editor.
I think you are confusing legacy v11 code with v12. You never need to use GetDialogAction any more for new dialogs. Scrap it. Forget it exists. Don't use it (unless your dialog really is a v11 one, but yours is NOT). Instead use GetDialogProperty to get a specific property value.
To get the selected value of the combobox - i.e. to determine what the user selected look at the Text or ItemIndex properties:
GetDialogProperty>Dialog1,MSComboBox1,Text,selectedItemText
GetDialogProperty>Dialog1,MSComboBox1,ItemIndex,selectedItemIndex
MessageModal>You Selected: %selectedItemText% (item: %selectedItemIndex%)
Get rid of your action loop, get rid of getdialogaction, get rid of resetdialogaction - none of this is needed for a v12 dialog.
If you are coming from v11 and adjusting to the new (more powerful, much easier, faster) model you might want to read this:
A Crib Sheet for the New Dialog Structure:
http://www.mjtnet.com/forum/viewtopic.php?t=6110
I think you are confusing legacy v11 code with v12. You never need to use GetDialogAction any more for new dialogs. Scrap it. Forget it exists. Don't use it (unless your dialog really is a v11 one, but yours is NOT). Instead use GetDialogProperty to get a specific property value.
To get the selected value of the combobox - i.e. to determine what the user selected look at the Text or ItemIndex properties:
GetDialogProperty>Dialog1,MSComboBox1,Text,selectedItemText
GetDialogProperty>Dialog1,MSComboBox1,ItemIndex,selectedItemIndex
MessageModal>You Selected: %selectedItemText% (item: %selectedItemIndex%)
Get rid of your action loop, get rid of getdialogaction, get rid of resetdialogaction - none of this is needed for a v12 dialog.
If you are coming from v11 and adjusting to the new (more powerful, much easier, faster) model you might want to read this:
A Crib Sheet for the New Dialog Structure:
http://www.mjtnet.com/forum/viewtopic.php?t=6110
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Help with Dialog ComboBox
Marcus,
Ok I think I understand how to use GetDialogProperty and SetDialogProperty.
Where I’m have diffuclity is with incorprationg my old logic into the new dialog.
Old logic:
Sorry I don’t mean to insult your code reading skills, but in case I left some code out here’s a short description.
As you can see when a date is entered and Update Flag =1 the If statements are read and
If a match is found the SrvContNum is updated.
This is during input not after a button is clicked.
My attempts at new logic.
I’m not sure if the Length statement is needed or is the a better way to test for data?
Are the If statemens correct ?
How do I test for data in a field and update another before I run GetDialogProperty for the complete dialog box?
I thought maybe the AddDialogHandler might work, but it appeared it’s used more for buttons events.
Thanks
Gil
Ok I think I understand how to use GetDialogProperty and SetDialogProperty.
Where I’m have diffuclity is with incorprationg my old logic into the new dialog.
Old logic:
Code: Select all
Step_Delay=200
Let>vWait=0.75
Let>SW=0.25
Let>UpdateFlag=1
Let>IGNORESPACES=1
Label>ActionLoop
GetDialogAction>BoLDialog,r
If>{(%BoLDialog.ShpName% = "SUNNY") AND (%BoLDialog.SLCode% = "MOLU")}
Let>SrvContNum=8205852A10
EndIf
If>{(%BoLDialog.ShpName% = "SUNNY") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE095052
EndIf
If>{(%BoLDialog.ShpName% = "UNITED") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE095055
EndIf
Length>BoLDialog.DDate,vLen
If>{(%vlen%=6)and(%UpdateFlag%=1)},Update
If>r=1,Update
If>r=2,Close
GoTo>ActionLoop
SRT>Update
Let>UpdateFlag=0
Let>BoLDialog.SrvContract=%SrvContNum%
ResetDialogAction>BoLDialog
END>Update
Label>Close
CloseDialog>BoLDialog
As you can see when a date is entered and Update Flag =1 the If statements are read and
If a match is found the SrvContNum is updated.
This is during input not after a button is clicked.
My attempts at new logic.
Code: Select all
If>{(%ShpName% = "BARNES") AND (%SLCode% = "OOLU")}
SetDialogProperty>BolDialog,SrvContract,Text,AE095045
EndIf
If>{(%ShpName% = "DIVE") AND (%SLCode% = "APLU")}
SetDialogProperty>BolDialog,SrvContract,Text,EXPIRED
EndIf
Length>DDate,vLen
If>{(%vlen%=6)},SetDialogProperty>BolDialog,SrvContract,Text,SrvContNum
Are the If statemens correct ?
How do I test for data in a field and update another before I run GetDialogProperty for the complete dialog box?
I thought maybe the AddDialogHandler might work, but it appeared it’s used more for buttons events.
Thanks
Gil
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
To trigger something during input create an event handler for the input box's OnChange event. Use AddDialogHandler.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Help with Dialog ComboBox
Marcus left me wanting!
Can someone please [b]elaborate [/b]no may last post.
I've spent the last 4 hours on the forum trying to find examples of how to use AddDialogHandler
I don't know if it makes a difference or not but all my If Statements are in another script and
called with a Include.
[code]
Dialog>BoLDialog
object BoLDialog: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Bill of Lading Info'
ClientHeight = 529
ClientWidth = 592
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 15
object msLabel1: TLabel
Left = 15
Top = 7
Width = 77
Height = 15
Caption = 'Shipper Name:'
end
Dialog code....
end
end
EndDialog>BoLDialog
AddDialogHandler>BoLDialog,SLCode,OnExit,GetContractNum
Show BoLDialog,r
If>r=2
GetDialogProperty>BolDialog,ShpName,Text,ShpName
GetDialogProperty>BolDialog,SrvContract,Text,SrvContract
GetDialogProperty>BolDialog,BkNum,Text,BkNum
EndIf
Include>F:\MS Sctipts\Europe\2_DialogAction.scp
SRT>GetContractNum
If>{(%ShpName% = "BARNES") AND (%SLCode% = "OOLU")}
SetDialogProperty>BolDialog,SrvContract,Text,AE095045
EndIf
If>{(%ShpName% = "DIVE") AND (%SLCode% = "APLU")}
SetDialogProperty>BolDialog,SrvContract,Text,EXPIRED
EndIf
END>GetContractNum
[/code]
After I exit the SLCode text box I get
"Subroutine/Label GetContractNum Not Found"
I also tried adding some of the include script to the BolDialog script and i get
"Syntax Error" and "Error Parsing Expression" on the first If Statement.
I [b]hate[/b] that I have to keep asking for help but in my experience there just it's
any good documentation on MS, and yes I'm a novice at scripting but how
can one get less dependent without ether better docs or some training videos.
Please don't get me wrong I like MS and have invested a lot of time and money in it(for a novice).
It's like taking one step forward and three back any time I want to tweak my scripts.
Sorry but I have to get that off my chest.
Gil
[/img]
Can someone please [b]elaborate [/b]no may last post.
I've spent the last 4 hours on the forum trying to find examples of how to use AddDialogHandler
I don't know if it makes a difference or not but all my If Statements are in another script and
called with a Include.
[code]
Dialog>BoLDialog
object BoLDialog: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Bill of Lading Info'
ClientHeight = 529
ClientWidth = 592
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 15
object msLabel1: TLabel
Left = 15
Top = 7
Width = 77
Height = 15
Caption = 'Shipper Name:'
end
Dialog code....
end
end
EndDialog>BoLDialog
AddDialogHandler>BoLDialog,SLCode,OnExit,GetContractNum
Show BoLDialog,r
If>r=2
GetDialogProperty>BolDialog,ShpName,Text,ShpName
GetDialogProperty>BolDialog,SrvContract,Text,SrvContract
GetDialogProperty>BolDialog,BkNum,Text,BkNum
EndIf
Include>F:\MS Sctipts\Europe\2_DialogAction.scp
SRT>GetContractNum
If>{(%ShpName% = "BARNES") AND (%SLCode% = "OOLU")}
SetDialogProperty>BolDialog,SrvContract,Text,AE095045
EndIf
If>{(%ShpName% = "DIVE") AND (%SLCode% = "APLU")}
SetDialogProperty>BolDialog,SrvContract,Text,EXPIRED
EndIf
END>GetContractNum
[/code]
After I exit the SLCode text box I get
"Subroutine/Label GetContractNum Not Found"
I also tried adding some of the include script to the BolDialog script and i get
"Syntax Error" and "Error Parsing Expression" on the first If Statement.
I [b]hate[/b] that I have to keep asking for help but in my experience there just it's
any good documentation on MS, and yes I'm a novice at scripting but how
can one get less dependent without ether better docs or some training videos.
Please don't get me wrong I like MS and have invested a lot of time and money in it(for a novice).
It's like taking one step forward and three back any time I want to tweak my scripts.
Sorry but I have to get that off my chest.
Gil
[/img]
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
If your GetContractNum subroutine is inside an include file then you will need to have your Include BEFORE your AddDialogHandler. This is because Include is not executed until execution reaches it. If you step through with the debugger what I am saying should become patently clear. Until the Include line is reached your subroutine doesn't exist, so asking AddDialogHandler to use it before you've included it will cause an error.
If you have an Include for your subroutines then put it at the top of your script.
Secondly, you'll want to get ShpName INSIDE your event handler. At present you're only getting it after the dialog is closed. Yet your handler routine will fire the moment you move focus away from the SLCode field. At that point ShpName doesn't exist yet because the dialog hasn't yet been closed. You don't want to get the value only after the dialog is closed, you want to retrieve it the moment the user exits the field (moves focus away) so in other words you want the event handler to always check the value of the field.
Looks to me like your event handler should be:
Note also that I have changed the name of the variables you are creating. You're asking for trouble by giving the exact same name as the objects. This would means subsequent calls to the subroutine may fail because ShpName would be something else and the object won't be found.
Note that you are using the OnExit event - so this would only fire when you leave the field - i.e. tab out of it or move focus out of it. Just checking that is what you want. You previously implied you wanted to fire the handler whenever it changed, which you could do with the OnChange event.
If you have an Include for your subroutines then put it at the top of your script.
Secondly, you'll want to get ShpName INSIDE your event handler. At present you're only getting it after the dialog is closed. Yet your handler routine will fire the moment you move focus away from the SLCode field. At that point ShpName doesn't exist yet because the dialog hasn't yet been closed. You don't want to get the value only after the dialog is closed, you want to retrieve it the moment the user exits the field (moves focus away) so in other words you want the event handler to always check the value of the field.
Looks to me like your event handler should be:
Code: Select all
SRT>GetContractNum
GetDialogProperty>BolDialog,ShpName,Text,varShpName
GetDialogProperty>BolDialog,SLCode,Text,varSLCode
If>{(%varShpName% = "BARNES") AND (%varSLCode% = "OOLU")}
SetDialogProperty>BolDialog,SrvContract,Text,AE095045
EndIf
If>{(%varShpName% = "DIVE") AND (%varSLCode% = "APLU")}
SetDialogProperty>BolDialog,SrvContract,Text,EXPIRED
EndIf
END>GetContractNum
Note that you are using the OnExit event - so this would only fire when you leave the field - i.e. tab out of it or move focus out of it. Just checking that is what you want. You previously implied you wanted to fire the handler whenever it changed, which you could do with the OnChange event.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Help with Dialog ComboBox
gchichester wrote:I hate that I have to keep asking for help but in my experience there just it's any good documentation on MS, and yes I'm a novice at scripting but how can one get less dependent without ether better docs or some training videos. Please don't get me wrong I like MS and have invested a lot of time and money in it(for a novice). It's like taking one step forward and three back any time I want to tweak my scripts. Sorry but I have to get that off my chest.
We try very hard, but I fear there will NEVER be enough documentation.
- The manual is over 200 pages long.
- There are 408 articles on the blog and I try to add more each week.
- 27965 articles in the forums.
- There's a section on dialogs in the help file and we made efforts to improve that greatly over the info that was there in v11.
- I made that crib sheet for people coming from v11.
- There are six dialog sample scripts demonstrating the new system (including event handlers) that come with version 12.
- There are some samples in the Scripts n Tips forum.
All that said I'd love to have more tutorials on dialogs. Frankly I'm not sure I'm the best person to make them. And I will happily bet my bottom dollar that there would still be questions from people and any contrived example beyond the 6 that already exist in the samples I can come up with will still not satisfy someone else's specific requirements.
If anyone out there has experience of creating educational material and understands the new dialog model then I'd be more than happy to talk.
There's also a point at which we go from helping people with Macro Scheduler to teaching people how to program. How far do we go?
I'm sorry you feel there isn't enough information. Actually though I know we offer far more help, assistance and documentation than ANY of our competitors.
But there can always be more, and in time there will be.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?