Jump to content

ComboBox Select Spams around


 Share

Recommended Posts

Hello everyone,

(my first Post, sorry if i made some misstakes :/)

So here is my little script:

#include <GUIConstants.au3>
#include <ComboConstants.au3>

$Form1 = GUICreate("", 100, 150, 193, 125)
$Button1 = GUICtrlCreateButton("Run It!", 12, 4, 75, 25, 0)   
$List1 = GUICtrlCreateList("", 12, 88, 75, 60,0)
GUICtrlSetData(-1, "Prog1|Prog2") 
GUISetState(@SW_SHOW)

While 1
    Global $cits=0
        Local $msg=GuiGetMsg()
        Select
            Case $msg=$Gui_Event_Close
                GuiSetState(@sw_hide)
            Case $msg=GuiCtrlRead("Prog1")
                MsgBox(1,"Prog1",$cits,0)
            Case $msg=GuiCtrlRead("Prog2")
                MsgBox(2,"Prog2",$cits,0)
        EndSelect
        
WEnd

(found something with the forum search, something in the docs, and some from Kodu ^_^ )

Sadly it doesnt work so good (I want to make a launcher for some Programs).

I think the misstake is in the loop, because the script Spam a lot of windows (Prog1)

Please help, and sorry for bad english

Link to comment
Share on other sites

Hello everyone,

(my first Post, sorry if i made some misstakes :/)

So here is my little script:

#include <GUIConstants.au3>
#include <ComboConstants.au3>

$Form1 = GUICreate("", 100, 150, 193, 125)
$Button1 = GUICtrlCreateButton("Run It!", 12, 4, 75, 25, 0)   
$List1 = GUICtrlCreateList("", 12, 88, 75, 60,0)
GUICtrlSetData(-1, "Prog1|Prog2") 
GUISetState(@SW_SHOW)

While 1
    Global $cits=0
        Local $msg=GuiGetMsg()
        Select
            Case $msg=$Gui_Event_Close
                GuiSetState(@sw_hide)
            Case $msg=GuiCtrlRead("Prog1")
                MsgBox(1,"Prog1",$cits,0)
            Case $msg=GuiCtrlRead("Prog2")
                MsgBox(2,"Prog2",$cits,0)
        EndSelect
        
WEnd

(found something with the forum search, something in the docs, and some from Kodu ^_^ )

Sadly it doesnt work so good (I want to make a launcher for some Programs).

I think the misstake is in the loop, because the script Spam a lot of windows (Prog1)

Please help, and sorry for bad english

Okay Searched a while, and found something:

#include <GUIConstants.au3>
#include <ComboConstants.au3>

Opt('MustDeclareVars', 1)

LAUNCHER()

Func LAUNCHER()
    Local  $n1, $n2, $msg, $menustate, $menutext
    
GUICreate("LAUNCHER")

 $n1 = GUICtrlCreateList("", 10, 10, -1, 100)
    GUICtrlSetData(-1, "item1|item2|item3", "item2")
    
 $n2 = GUICtrlCreateButton("Read", 10, 110, 50)

    
     GUISetState()
    Do
        $msg = GUIGetMsg()
        If $msg = $n2 Then
            MsgBox(0, "Selected listbox entry", GUICtrlRead($n1))
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
    
    
    
    
EndFunc

this works perfectly! thanks for anyone who would help! ;)

(sry couldnt edit the old post ?!?!)

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...