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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing combobox data to session 1

Status
Not open for further replies.

DustoBOE

Technical User
Dec 12, 2013
25
0
0
US
Hey, it's youre newest noob here again!

I made a combobox for a macro that I am making, but I have a quick question. I found some code that helped me with this one, but I'm not sure how to pass the selected value in the combo box to the quickpad, then to a field in the session once the "OK" button is clicked. I have:

'=============================================================
'======THIS IS THE COMBOBOX=========
Dim Make(6) as String 'quantity of slots in the list starts at 0
Make(0) = "BKirsch"
Make(1) = "JSmith"
Make(2) = "rjones"

Begin Dialog dlgOptions 10, 28, 100, 100, "Select"

OkButton 60, 20, 20, 10,.btnOK
DropComboBox 10, 20, 40, 20, Make(), .MakeComboBox

End Dialog
iDone = FALSE

While (iDone = FALSE) 'not sure what this section is doing.
Dim dlgVar as dlgOptions
nRet = Dialog(dlgVar)
Select Case nRet
Case -1
iDone = TRUE
End Select
Wend
'===================================================================

'check for the next blank line
Do
With objWorkBook.Worksheets("Sheet1").Cells(r, 1)
If Trim(.Value) = "" Then
.Value = gs
Exit Do
Else
'continue testing for the next row
r = r + 1
End If
End With
Loop

Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
'copy eash line to excel
gs = Sess0.Screen.GetString (03, 13, 06) 'Gets sup name
objWorkBook.WorkSheets("Sheet1").Cells(r,1).Value = gs 'Transfers case number to Excel
gs = Sess0.Screen.GetString (14, 19, 11) 'auditor
objWorkBook.WorkSheets("Sheet1").Cells(r,2).Value = gs 'Transfers auditor to Excel
gs = Sess0.Screen.GetString (14, 48, 10) 'Gets aud name
objWorkBook.WorkSheets("Sheet1").Cells(r,3).Value = gs 'Transfers supervisor to Excel



' Excel will remain open after this Sub ends.
' To close out Excel, unremark the following 4 lines of code. .
objExcel.ActiveWorkBook.Save
'objWorkBook.Close
'objExcel.Quit
'set objWorkBook = Nothing
'set objExcel = Nothing




End sub
 
Code:
    iDone = FALSE
 
    While (iDone = FALSE) 'This is what this does
        Dim dlgVar as dlgOptions
        nRet = Dialog(dlgVar)
        Select Case nRet
            Case -1     ' -1 is returned if the user chose OK
                'msgbox nRet
                iDone = TRUE 
                
            Case 0      ' 0 is returned if the user chose Cancel 
                'msgbox nRet
                Exit sub    
                
        End Select
    Wend
    
    YourSelection = dlgvar.MakeComboBox
    msgbox YourSelection
 
Remy, thanks for the suggestion, the button has been added. How does one get the text associated with the combobox selection to be pasted to the active session. Once the user clicks the button, I'd like the name to get pasted to the session. I can't find anything. And also, is this the only way to make a combobox? Or is there an easier way to create one for my purpose?

But my real question is, how does one get
'======THIS IS THE COMBOBOX=========
Dim cboname (18) as String 'quantity of slots in the list starts at 0
cboname(0) = "ANDE" 'The bolded text is what I would like to paste in the active session
cboname(1) = "CAST"
cboname(2) = "DU"
cboname(3) = "EL"
cboname(4) = "HERN"
cboname(5) = "HERR"
cboname(6) = "KAWA"
cboname(7) = "LFOM"
cboname(8) = "MUS"
cboname(9) = "OR"
cboname(10) = "PAG"
cboname(11) = "RIV"
cboname(12) = "ROD"
cboname(13) = "SAN"
cboname(14) = "SOT"
cboname(15) = "SOU"
cboname(16) = "STA"
cboname(17) = "VIL"
cboname(18) = "VIZ"


Begin Dialog dlgOptions 10, 28, 140, 140, "Select"

OkButton 80, 22, 30, 10,.btnOK
DropComboBox 10, 20, 60, 20, cboname(), .cbonameComboBox
cancelbutton 80, 62, 30, 10, .btnCancel
End Dialog
iDone = FALSE

While (iDone = FALSE) 'not sure what this section is doing.
Dim dlgVar as dlgOptions
nRet = Dialog(dlgVar)
Select Case nRet
Case -1
iDone = TRUE
Case 0 ' 0 is returned if the user chose Cancel
'msgbox nRet
Exit sub
 
the answer was in my first post
Code:
    YourSelection = dlgvar.[blue]MakeComboBox[/blue]
    msgbox YourSelection


but you changed your code from
Code:
DropComboBox 10, 20, 40, 20, Make(), .[blue]MakeComboBox[/blue]
to
Code:
DropComboBox 10, 20, 60, 20, cboname(), [blue].cbonameComboBox[/blue]

 
Remy, I see what you were sayin'. Thanks again. And i DO like the "cancel" button.

I want the selection that I choose from the dropdown box to get pasted to a coordinate on the screen, rather that showing in a dialog box. The goal is for the name that is chosen from the list, the OK button pressed, then the name is pasted to a coordinate on the screen, then updated.
 
something like this should work
Code:
sess0.screen.putstring YourSelection, r,c

where r = row coordinate & c = col coordinate
 
I owe you a beer Remy, tanks for all you help.

is there a reference to the methods properties and whatnot attachmate uses? It's hard to find anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top