Kademlia Posted February 7, 2010 Share Posted February 7, 2010 (edited) Hey, I got some problems with GUICtrlSetData,GUICtrlCreateInput and GUICtrlCreateEdit I wans´t able to work around. Every time I insert text with GuiCtrlSetData into the EditField the text inside the InputText will be copied too (if changed). Example Code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $ConsoleGui = GUICreate("Console",500,300,50,50,-1,$WS_EX_ACCEPTFILES) Global $ConsoleList = GUICtrlCreateEdit("",5,5,490,270, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY) ) Global $ConsoleInput = GUICtrlCreateInput("",5,275,490,20) Global $SecondsTimer = TimerInit() GUISetState(@SW_SHOW) Opt("GUIOnEventMode", 0) while True Local $msg = GUIGetMsg() Switch $msg Case $ConsoleInput GUICtrlSetData($ConsoleList,GUICtrlRead($ConsoleInput),1) Case $GUI_EVENT_CLOSE Exit EndSwitch CheckTimer() WEnd Func CheckTimer() If TimerDiff($SecondsTimer) > 500 Then GUICtrlSetData($ConsoleList,"..." & @CRLF,1) $SecondsTimer = TimerInit() EndIf EndFunc Second thing: GUICtrlCreateEdit("",5,5,490,270, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY) ) Should create a READONLY EditField. But i´m still able to change the text by highlighting (hold mouse down and move cursor) parts of the text with my mouse cursor. This works in the example above. If someone has a fix for this or just a hint i´d be happy to hear about it. Thanks. Edited February 7, 2010 by Kademlia Link to comment Share on other sites More sharing options...
KaFu Posted February 7, 2010 Share Posted February 7, 2010 (edited) $ES_READONLY: Prevents the user from typing or editing text in the edit control. Thats what it does, i also would have expected it to prevent cutting, but that's not what's documented . Add GUICtrlSetState(-1,$GUI_DISABLE) directly after creating the edit control. Otherwise the GUI behaves as I would expect... you call GUICtrlSetData() twice in the loop, once on input and once via a timed function. Maybe you should clarify a little more what you want it to do . Also check out the documentation of the third parameter you use with GUICtrlSetData(). Edited February 7, 2010 by KaFu 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...
ProgAndy Posted February 7, 2010 Share Posted February 7, 2010 Every time the input looses focus and has changed text, the changed-event occurs. You should use an Accelerator-key to send the input to the console instead of using the input-Changed event: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $ConsoleGui = GUICreate("Console",500,300,50,50,-1,$WS_EX_ACCEPTFILES) Global $ConsoleList = GUICtrlCreateEdit("",5,5,490,270, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY) ) Global $ConsoleInput = GUICtrlCreateInput("",5,275,490,20) Global $SecondsTimer = TimerInit() $ENTER_DUMMY= GUICtrlCreateDummy() Dim $accel[1][2] = [["{ENTER}", $ENTER_DUMMY]] GUISetAccelerators($accel) GUISetState(@SW_SHOW) Opt("GUIOnEventMode", 0) while True Local $msg = GUIGetMsg() Switch $msg Case $ENTER_DUMMY GUICtrlSetData($ConsoleList,GUICtrlRead($ConsoleInput),1) Case $GUI_EVENT_CLOSE Exit EndSwitch CheckTimer() WEnd Func CheckTimer() If TimerDiff($SecondsTimer) > 500 Then GUICtrlSetData($ConsoleList,"..." & @CRLF,1) $SecondsTimer = TimerInit() EndIf EndFunc *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 Link to comment Share on other sites More sharing options...
Kademlia Posted February 7, 2010 Author Share Posted February 7, 2010 (edited) Hey, thanks for answering. I´d like to use $GUI_DISABLE [ Control will be greyed out. ] But gray on gray is not that readable... and GUICtrlSetColor($-1, 0x000000) won´t change it back About the GUICtrlSetData() I tried to make some kind of Logging/ConsoleInput window. Text can be inserted by the User using GUICtrlCreateInput. The program itself will add Logging information to the window all the time depending on the DebugLevel [Date/Time information and some Statistic values] A User should be able to write inside the InputBox and publish the text into EditField by pressing enter. But everytime the Timer Based function inserts a text into the EditField the current text of that InputBox will be added too. Edit: Thanks GUISetAccelerators works fine. I think i will have a closer look on that one. Edited February 7, 2010 by Kademlia 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