Greetings Opus Comrades
Below is a troubleshooting/sample script of a Script Dialog of the Simple variety.
Scenario
I believe the object hierarchy at play is that in the topic name.
That is
Script Dialog > Simple Dialog > Dlg.Control("Combo_Box") > DialogListItem.
Objective
I want to access more stuff from my Combo Box.
The only thing I get currently is an integer representing the pulldown list number I have selected when running the script.
That is obtained from these lines in the script:
DOpus.Output " 010 Combo_Box index = " & Dlg.Control("Combo_Box").value Combo_Box_Index = Dlg.Control("Combo_Box").value
For example you will note that I reproduce the Combo_Box items in an array in the script:
Pulldown_Array = Array(Entry01,Entry02,Entry03,Entry04,Entry05)
Q1 - Can I not pull this in from the dialog somehow?
Maybe via access to the DialogListItem that I read the Combo_Box returns?
Q2 - In the context of this sample script, what else can DialogListItem give me?
How to Access DialogListItem
Is Combo_Box_Index a DialogListItem object?
When I tried to reference say Combo_Box_Index.index like this:
DOpus.Output " 035 Combo_Box_Test_Entry.index = " & Combo_Box_Test_Entry.index
I got an error basically telling me that was not an object:
So then
Q3 - How do I access DialogListItem?
Working Script Run Through
There script and supporting dialog xml is at the bottom of this post.
Script Details
Function OnClick(ByRef clickData)
DOpus.ClearOutput
DOpus.Output "001000 Start"
' 001000
' 001000 Start
' 001000
Pulldown_Array = Array("Entry01","Entry02","Entry03","Entry04","Entry05")
Set Dlg = DOpus.Dlg
Dlg.window = clickData.func.sourcetab
Dlg.template = "dialog1"
retVal = Dlg.Show()
' 002000
' 002000 Results
' 002000
DOpus.Output "002000 Results"
DOpus.Output " 010 Combo_Box index = " & Dlg.Control("Combo_Box").value
Combo_Box_Index = Dlg.Control("Combo_Box").value
DOpus.Output " 020 Combo_Box_Index = " & Combo_Box_Index
Combo_Box_Test_Entry = Pulldown_Array(Combo_Box_Index)
DOpus.Output " 030 Combo_Box_Test_Entry = " & Combo_Box_Test_Entry
' DOpus.Output " 035 Combo_Box_Test_Entry.index = " & Combo_Box_Test_Entry.index < Error if included
DOpus.Output " 040 Suffix = " & Dlg.Control("Suffix").value
Suffix_Entry = Dlg.Control("Suffix").value
DOpus.Output " 050 Dlg.result = " & Dlg.result
DOpus.Output " 060 Return code = " & retVal
if ratVal = "0" then
DOpus.Output " 070 Dlg.result = 0 so want top exit"
end if
' 003000
' 003000 Case Statement
' 003000
DOpus.Output "003000 Case statement"
'
Select Case Combo_Box_Test_Entry
Case "Entry01"
DOpus.Output(" 020b Combo_Box = " & Dlg.Control("Combo_Box").value)
Case "Entry02"
Case Else
End Select
DOpus.Output("004000 End")
End Function
**Accompanying Dailog XML**
<resources>
<resource name="dialog1" type="dialog">
<dialog fontsize="8" height="60" lang="english" standard_buttons="ok,cancel" title="Prepare to Go" width="180">
<control height="40" name="Combo_Box" type="combo" width="64" x="24" y="24">
<contents>
<item text="Entry01" />
<item text="Entry02" />
<item text="Entry03" />
<item text="Entry04" />
<item text="Entry05" />
</contents>
</control>
<control halign="left" height="12" name="Suffix" tip="Suffix" type="edit" width="64" x="96" y="24" />
</dialog>
</resource>
</resources>
Script Dialog Screenshot
Start Again! Debuggginh.dcf (4.9 KB)