Jump to content
Sign in to follow this  
Gordoni

GUICtrlCreateCombo

Recommended Posts

Gordoni

Here is my 1% of all code with that need help

$fake = GUICtrlCreateCombo('', 25, 125, 105, 20, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, 'Combo Item 1|Combo Item 2|Combo Item 3')
Func ComboRun()
    If $fake = "Combo Item 1" then ShellExecute("http://combo1.com")
If $fake = "Combo Item 2" then ShellExecute("http://combo2.com")
If $fake = "Combo Item 3" then ShellExecute("http://combo3.com")
EndFunc

When i start func ComboRun() from my gui button that doesnt work

Looking for help :D


Share this post


Link to post
Share on other sites
Yashied

Func ComboRun()
    
    Local $Data = GUICtrlRead($fake)
    
    Switch $Data
        Case "Combo Item 1"
            ShellExecute("http://combo1.com")
        Case "Combo Item 2"
            ShellExecute("http://combo2.com")
        Case "Combo Item 3"
            ShellExecute("http://combo3.com")
    EndSwitch
EndFunc   ;==>ComboRun

Share this post


Link to post
Share on other sites
Gordoni

I dont know why but script doesnt work . Looking for help with fixing.

#include <INet.au3>
#include <string.au3>
#Include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <guiconstants.au3>
#include <ComboConstants.au3>
#include-once


$hwnd = GUICreate("Program", 400, 75)
$ComboRun = GUICtrlCreateButton("Go", 25, 10, 25, 20)
    GUICtrlSetOnEvent($ComboRun, "ComboRun")

$fake = GUICtrlCreateCombo('', 50, 10, 250, 20, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, 'a1.com|a2.com|a3.com')
GUISetState ()
Func ComboRun()
    Local $Data2 = GUICtrlRead($fake)
    
    Switch $Data2
        Case "a1.com"
            ShellExecute("http://a1.com")
        Case "a2.com"
            ShellExecute("http://a2.com")
        Case "a3.com"
            ShellExecute("http://a3.com")
        EndSwitch
    EndFunc
    
While 1
    $msg=GUIGetMsg ()
    if $msg=$GUI_EVENT_CLOSE Then ExitLoop
WEnd

Share this post


Link to post
Share on other sites
rajeshontheweb

While 1
    $msg=GUIGetMsg ()
    if $msg=$GUI_EVENT_CLOSE Then ExitLoop
;   If $msg = $fake Then ComboRun()
        If $msg = $ComboRun Then ComboRun()
WEnd

or

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
 ExitLoop
;Case $fake
Case $ComboRun ; sorry for the hasty response!
ComboRun()
EndSwitch
WEnd
Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
Zedna

You mixed OnEvent and Message modes.

#include <INet.au3>
#include <string.au3>
#Include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <guiconstants.au3>
#include <ComboConstants.au3>


$hwnd = GUICreate("Program", 400, 75)
$ComboRun = GUICtrlCreateButton("Go", 25, 10, 25, 20)
$fake = GUICtrlCreateCombo('', 50, 10, 250, 120, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, 'a1.com|a2.com|a3.com')
GUISetState ()

While 1
    $msg=GUIGetMsg ()
    if $msg=$GUI_EVENT_CLOSE Then ExitLoop
    if $msg=$ComboRun Then ComboRun()
WEnd

Func ComboRun()
    Local $Data2 = GUICtrlRead($fake)
   
    Switch $Data2
        Case "a1.com"
            ShellExecute("http://a1.com")
        Case "a2.com"
            ShellExecute("http://a2.com")
        Case "a3.com"
            ShellExecute("http://a3.com")
        EndSwitch
EndFunc

Share this post


Link to post
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
Sign in to follow this  

×