Jump to content

Help


 Share

Recommended Posts

Hello guys

what is wrong in these code

#include <GUIConstantsEx.au3>

$hGUI=GUICreate("COMBO" , 200 , 200 )
$hEDIT=GUICtrlCreateEdit("",10,50,150,115)

$hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 )
GUICtrlSetData($hCOMBO , "1|2|3")



GUISetState()

combo()


    

 Func combo()
    
    
    
    $hGUI=GUICreate("COMBO" , 200 , 200 )
    $hEDIT=GUICtrlCreateEdit("",10,50,150,140)

    $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 )
    GUICtrlSetData($hCOMBO , "1|2|3")


    
While 1 
    
    $msg= GUIGetMsg()
    if $msg= $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
    
    $return=GUICtrlRead($hCOMBO)
    
            Switch $return
                
                Case "1"
                    GUICtrlSetData($hEDIT, " The number you are chose is (1) " )
                    
                Case "2"
                    GUICtrlSetData($hEDIT, " The number you are chose is (2) " )
                    
                Case "3"
                    GUICtrlSetData($hEDIT, " The number you are chose is (3) " )
                    
            EndSwitch
    
WEnd
EndFunc

I'm want if I'm chose number from the combo list then print text in the edit space

but the code is not work correctly

wait your help

Thanks

Link to comment
Share on other sites

Another way...Posted Image

#include <GUIConstantsEx.au3>
Opt ( "GuiOnEventMode", 1 ) 

Global $hGUI, $hEDIT

$hGUI=GUICreate("COMBO" , 200 , 200 )
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Exit", $hGUI )
$hEDIT=GUICtrlCreateEdit("",10,50,150,115)
$hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 )
GUICtrlSetOnEvent ( $hCOMBO, '_ReadCombo' )
GUICtrlSetData($hCOMBO , "1|2|3")
GUISetState()

While 1 
    Sleep ( 20 )
WEnd     

Func _ReadCombo ( )
    $_SelectedCombo = GUICtrlRead ( $hCOMBO )
    ConsoleWrite ( "$_SelectedCombo : " & $_SelectedCombo & @Crlf )
    GUICtrlSetData ( $hEDIT, " The number you are chose is (" & $_SelectedCombo & ") " )
EndFunc ;==> _Read ( )

Func _Exit ( )
    Exit
EndFunc ;==> _Exit ( )

Delete duplicate topic or change title of One...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Another way...Posted Image

#include <GUIConstantsEx.au3>
Opt ( "GuiOnEventMode", 1 ) 

Global $hGUI, $hEDIT

$hGUI=GUICreate("COMBO" , 200 , 200 )
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Exit", $hGUI )
$hEDIT=GUICtrlCreateEdit("",10,50,150,115)
$hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 )
GUICtrlSetOnEvent ( $hCOMBO, '_ReadCombo' )
GUICtrlSetData($hCOMBO , "1|2|3")
GUISetState()

While 1 
    Sleep ( 20 )
WEnd     

Func _ReadCombo ( )
    $_SelectedCombo = GUICtrlRead ( $hCOMBO )
    ConsoleWrite ( "$_SelectedCombo : " & $_SelectedCombo & @Crlf )
    GUICtrlSetData ( $hEDIT, " The number you are chose is (" & $_SelectedCombo & ") " )
EndFunc ;==> _Read ( )

Func _Exit ( )
    Exit
EndFunc ;==> _Exit ( )

Delete duplicate topic or change title of One...

Thanks a lot , this is smart code!all thing is OK

I'm so sorry to duplicate topic thats happen by wrong

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