Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialbox and Double-click

Status
Not open for further replies.

DurwoodMI

Technical User
Dec 22, 2003
4
US
I have a script that creates a dialog box for selecting a connection and then connecting to it. The following is the dialog box code.

dialogbox 0 8 22 260 114 2 "Select Connection From List"
listbox 1 7 2 204 105 sList SINGLE sChoice
checkbox 2 214 81 42 11 "Console" sConsole
pushbutton 3 214 94 42 14 "Dial"
enddialog

I was wondering if there is a way to make a double-click of a selection in the listbox work the same as clicking the pushbutton?
 
Here's an example which combines your snippet and a sample script from the ASPECT help file:

proc main
string sChoice, sList
integer sConsole
integer Event

sList = "one,two,three"
dialogbox 0 8 22 260 114 2 "Select Connection From List"
listbox 1 7 2 204 105 sList SINGLE sChoice
checkbox 2 214 81 42 11 "Console" sConsole
pushbutton 3 214 94 42 14 "Dial"
enddialog

while 1
dlgevent 0 Event ; Get the dialog event.

switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
exitwhile
endcase
default ; Exit case chosen.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
dial DATA sChoice
while $DIALING
yield
endwhile
endproc

Basically you just need to make sure that the case statement for the listbox exits the switch structure since the double click will properly set your selection.


aspect@aspectscripting.com
 
Thanks, got me going in the right direction. I tweaked it though with an if and integer so it takes more than a single-click to satisfy the case. Something a little closer to a double-click and so I don't lose the ability to to jump to a letter by pressing a key.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top