Jump to content

Button opens the selected item inside the cbox


 Share

Go to solution Solved by benners,

Recommended Posts

hi all

I should open the item selected in the combobox with a button, example: if I select the temp directory and then close, I would like to be able to reopen it with a button as well as with the combobox

$sData = "|Local Temp|Win Temp|Windows Dir" 
$cCombo = GUICtrlCreateCombo("", 5, 5, 120, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
$BtnCombo = GUICtrlCreateButton("Open Dir", 5, 50, 100, 25)

;it does not work!
Case $BtnCombo
GUICtrlSetData($cCombo,$sData) 

;it works very well
Case $cCombo
Switch GUICtrlRead($cCombo)
Case "Local Temp"
ShellExecute(@TempDir)
Case "Win Temp"
ShellExecute(@WindowsDir & "\Temp")
Case "Windows"
ShellExecute(@WindowsDir")
EndSwitch

 

Link to comment
Share on other sites

  • Solution

Put the $BtnCombo on the same line as the $cCombo

$sData = "|Local Temp|Win Temp|Windows Dir" 
$cCombo = GUICtrlCreateCombo("", 5, 5, 120, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
GUICtrlSetData(-1,$sData) 
$BtnCombo = GUICtrlCreateButton("Open Dir", 5, 50, 100, 25)

;it works very well
Case $cCombo, $BtnCombo
Switch GUICtrlRead($cCombo)
Case "Local Temp"
ShellExecute(@TempDir)
Case "Win Temp"
ShellExecute(@WindowsDir & "\Temp")
Case "Windows"
ShellExecute(@WindowsDir")
EndSwitch

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...