Jump to content
Sign in to follow this  
myspacee

Add 'Key pressed' feature

Recommended Posts

myspacee

hello to all,

search for an help.

Want to add 'key pressed' feature to my GUI.

When user press [return] i obtain same result that OK button does ...

see different functions but can't add in my GUICtrlCreateCombo based GUI.

Anyone can help me ?

m.

;////////////////////////////////////////////////////////////////////////
;       variables
;////////////////////////////////////////////////////////////////////////
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <misc.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>
#Include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <GUIComboBox.au3>
Opt('MustDeclareVars', 1)
#Include <GuiButton.au3>

local $file, $line, $Button_ok, $Button_cancel, $Button_ok_B, $Button_cancel_B, $msg
local $avArray[1]
local $sText
local $hCombo, $retval
local $avFile

;////////////////////////////////////////////////////////////////////////
;       GUI
;////////////////////////////////////////////////////////////////////////
#Region ### START Koda GUI section ### Form=
GUICreate("ComboBox select from list", 396, 600)
;~ $_1 = GUICreate("ComboBox seleziona dalla lista", 247, 718, 393, 133)
$hCombo = GUICtrlCreateCombo("", 2, 60, 396, 500, BitOR($CBS_SIMPLE,$CBS_AUTOHSCROLL,$CBS_DISABLENOSCROLL,$WS_VSCROLL))
$Button_ok = GUICtrlCreateButton("OK", 16, 20, 70, 25, 0)
$Button_cancel = GUICtrlCreateButton("Cancel", 100, 20, 70, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;////////////////////////////////////////////////////////////////////////
;       GUI until user action
;////////////////////////////////////////////////////////////////////////
    
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            $my_selection = ""
            msgbox(0,"","GUI_EVENT_CLOSE")
            ExitLoop
        Case $Button_ok
            msgbox(0,"","OK pressed")
            GUIDelete()
            sleep(100)
            ExitLoop
        Case $Button_cancel
            msgbox(0,"","Cancel pressed")
            
            ExitLoop
            
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
ProgAndy

Just use a defpushbutton :P $Button_ok = GUICtrlCreateButton("OK", 16, 20, 70, 25, $BS_DEFPUSHBUTTON)


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
myspacee

my hero,

m.

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  

×