×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Passing combobox data to session

Passing combobox data to session

Passing combobox data to session

(OP)
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

RE: Passing combobox data to session

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 

RE: Passing combobox data to session

you need to or should add a CANCEL BUTTON

RE: Passing combobox data to session

(OP)
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

RE: Passing combobox data to session

the answer was in my first post

CODE

YourSelection = dlgvar.MakeComboBox
    msgbox YourSelection 


but you changed your code from

CODE

DropComboBox 10, 20, 40, 20, Make(), .MakeComboBox 
to

CODE

DropComboBox 10, 20, 60, 20, cboname(), .cbonameComboBox 

RE: Passing combobox data to session

(OP)
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.

RE: Passing combobox data to session

something like this should work

CODE

sess0.screen.putstring YourSelection, r,c 

where r = row coordinate & c = col coordinate

RE: Passing combobox data to session

(OP)
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.

RE: Passing combobox data to session

the Help files are helpful

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close