microbious Posted June 14, 2009 Share Posted June 14, 2009 $MessagesWindow = GUICtrlCreateEdit ($ServerMSG1,240,0,260,60) How to edit this so it would remember previously entered text ? Maybe a dropdown arrow ? Thanks Link to comment Share on other sites More sharing options...
BrettF Posted June 14, 2009 Share Posted June 14, 2009 (edited) Like this? expandcollapse popup#include <GUIComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) $Debug_CB = False; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $hCombo Example_Internal() Func Example_Internal() Local $hGUI ; Create GUI $hGUI = GUICreate("(Internal) ComboBox Auto Complete", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 20, BitOR ($CBS_NOINTEGRALHEIGHT, $CBS_SIMPLE)) GUISetState() ; Add files _GUICtrlComboBox_BeginUpdate ($hCombo) _GUICtrlComboBox_AddString ($hCombo, "Text 1") _GUICtrlComboBox_AddString ($hCombo, "Text 2") _GUICtrlComboBox_AddString ($hCombo, "Paulie") _GUICtrlComboBox_AddString ($hCombo, "BrettF") _GUICtrlComboBox_AddString ($hCombo, "LOL") _GUICtrlComboBox_EndUpdate ($hCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Sleep (10) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example_Internal Func _Edit_Changed() _GUICtrlComboBox_AutoComplete ($hCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF); Low Word $iCode = BitShift($iwParam, 16); Hi Word Switch $hWndFrom Case $hCombo, $hWndCombo Switch $iCode Case $CBN_EDITCHANGE; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box _Edit_Changed() EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND You will also have to make sure it adds new values when typed in or whatever... Edited June 14, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
microbious Posted June 14, 2009 Author Share Posted June 14, 2009 sorry your example makes no sense to me just yet but thanks for GUICtrlCreateCombo I want it to remember previously entered information (maybe save it somewhere like history.txt ?) Link to comment Share on other sites More sharing options...
rajeshontheweb Posted June 14, 2009 Share Posted June 14, 2009 this works #include <GUIConstants.au3> #include <GUICombobox.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 496, 132, 193, 125) $cboSearch = GUICtrlCreateCombo("cboSearch", 96, 56, 193, 25) $btnSearch = GUICtrlCreateButton("btnSearch", 320, 56, 73, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cboSearch Case $btnSearch ; your funciton here and then _GUICtrlComboBox_AddString($cboSearch,GUICtrlRead($cboSearch)) EndSwitch WEnd but if want the history to reappear after the application is closed and reopened then use a history.txt or something , fill the contents of cbosearch to the file and then reload it on open. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
Authenticity Posted June 14, 2009 Share Posted June 14, 2009 expandcollapse popup#include <Array.au3> #include <Constants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $hGUI Global $EditCtrl, $hEditCtrl Global $hFunc, $pFunc Global $hOldProc Global $aBuffers[2] = [0, ''] $hGUI = GUICreate('Test', 500, 500) $EditCtrl = GUICtrlCreateEdit('', 0, 0, 500, 500) $hEditCtrl = GUICtrlGetHandle(-1) $hFunc = DllCallbackRegister('EditProc', 'int', 'uint;uint;uint;uint') $pFunc = DllCallbackGetPtr($hFunc) $hOldProc = _WinAPI_SetWindowLong($hEditCtrl, $GWL_WNDPROC, $pFunc) GUISetState() Do Until GUIGetMsg() = -3 GUIDelete() DllCallbackFree($hFunc) Func EditProc($hwnd, $iMsg, $iwParam, $ilParam) Local $sBuffer If $iMsg = $WM_CHAR Then Switch $iwParam Case 0x18 ; Ctrl+x ; TODO: ...redo Case 0x1A ; Ctrl+z If $aBuffers[0] > 0 Then GUICtrlSetData($EditCtrl, $aBuffers[$aBuffers[0]]) _ArrayPop($aBuffers) $aBuffers[0] -= 1 EndIf Case Else _ArrayAdd($aBuffers, GUICtrlRead($EditCtrl)) $aBuffers[0] += 1 EndSwitch EndIf Return _WinAPI_CallWindowProc($hOldProc, $hwnd, $iMsg, $iwParam, $ilParam) EndFunc Link to comment Share on other sites More sharing options...
KaFu Posted June 14, 2009 Share Posted June 14, 2009 Case 0x1A ; Ctrl+zNice idea , saved .. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
microbious Posted June 14, 2009 Author Share Posted June 14, 2009 rajeshontheweb BEST EXAMPLE EVER thanks Link to comment Share on other sites More sharing options...
BrettF Posted June 14, 2009 Share Posted June 14, 2009 I quite liked Authenticity's example more.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now