notta Posted May 6, 2009 Share Posted May 6, 2009 Is there a way other then setting focus to the edit box to make the text not highlighted? There is a noticeable flicker using this method. Thanks. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Example1() ; example 1 Func Example1() Local $msg Local $something = "Creates a window that has a thin-line border." & _ "$WS_POPUP 0x80000000 Creates a pop-up window. This style cannot be used with the WS_CHILD style." & _ "$WS_CAPTION 0x00C00000 Creates a window that has a title bar (includes the WS_BORDER style)" & _ "$WS_CLIPCHILDREN 0x02000000 Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window. " $GUI = GUICreate("My GUI", 300, 300) ; will create a dialog box that when displayed is centered $btn = Guictrlcreatebutton("Open", 135, 118, 35, 30) $aTest = WinGetPos("My GUI") $GUI2 = GUICreate("Second Winder", $aTest[2], $aTest[3] - 32, $aTest[0] + $aTest[2], $aTest[1], $WS_CAPTION) $edit = GUICtrlCreateEdit($something, 0, 0, $aTest[2], $aTest[3] - 32, $ES_MULTILINE + $WS_VSCROLL + $ES_WANTRETURN + $ES_READONLY) GUISetState(@SW_HIDE, $GUI2) GUISetState(@SW_SHOW, $GUI) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $btn Then if Not BitAND(WinGetState("Second Winder"), 2) Then GUISetState(@SW_SHOW, $GUI2) ;GUICtrlSetState($edit,$GUI_FOCUS) Else GUISetState(@SW_HIDE, $GUI2) EndIf EndIf WEnd GUIDelete() EndFunc ;==>Example1 Link to comment Share on other sites More sharing options...
Authenticity Posted May 6, 2009 Share Posted May 6, 2009 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $btn Then if Not BitAND(WinGetState("Second Winder"), 2) Then GUISetState(@SW_SHOW, $GUI2) GUICtrlSendMsg($edit, $EM_SETSEL, 0, 0) ; Maybe like this. ;GUICtrlSetState($edit,$GUI_FOCUS) Else GUISetState(@SW_HIDE, $GUI2) EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
notta Posted May 6, 2009 Author Share Posted May 6, 2009 (edited) Nah, it still happens. Setting focus to the edit control and back to a control on the main GUI seems to fix the issue, but seems like a "hacky" way of doing it. Any idea why the text gets highlighted like that? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Example1() ; example 1 Func Example1() Local $msg Local $something = "Creates a window that has a thin-line border." & _ "$WS_POPUP 0x80000000 Creates a pop-up window. This style cannot be used with the WS_CHILD style." & _ "$WS_CAPTION 0x00C00000 Creates a window that has a title bar (includes the WS_BORDER style)" & _ "$WS_CLIPCHILDREN 0x02000000 Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window. " $GUI = GUICreate("My GUI", 300, 300) ; will create a dialog box that when displayed is centered $btn = Guictrlcreatebutton("Open", 135, 118, 35, 30) $aTest = WinGetPos("My GUI") $GUI2 = GUICreate("Second Winder", $aTest[2], $aTest[3] - 32, $aTest[0] + $aTest[2], $aTest[1], $WS_CAPTION) $edit = GUICtrlCreateEdit($something, 0, 0, $aTest[2], $aTest[3] - 32, $ES_MULTILINE + $WS_VSCROLL + $ES_WANTRETURN + $ES_READONLY) GUICtrlSetState($edit,$GUI_FOCUS) GUICtrlSetState($btn,$GUI_FOCUS) GUISetState(@SW_HIDE, $GUI2) GUISetState(@SW_SHOW, $GUI) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $btn Then if Not BitAND(WinGetState("Second Winder"), 2) Then GUISetState(@SW_SHOW, $GUI2) ;GUICtrlSendMsg($edit,$EM_SETSEL, 0, 0) ;GUICtrlSetState($edit,$GUI_FOCUS) Else GUISetState(@SW_HIDE, $GUI2) EndIf EndIf WEnd GUIDelete() EndFunc ;==>Example1 Edited May 6, 2009 by notta Link to comment Share on other sites More sharing options...
Authenticity Posted May 6, 2009 Share Posted May 6, 2009 expandcollapse popup#include <Constants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Const $WS_EX_NOACTIVATE = 0x08000000 Example1() ; example 1 Func Example1() Local $msg Local $something = "Creates a window that has a thin-line border." & _ "$WS_POPUP 0x80000000 Creates a pop-up window. This style cannot be used with the WS_CHILD style." & _ "$WS_CAPTION 0x00C00000 Creates a window that has a title bar (includes the WS_BORDER style)" & _ "$WS_CLIPCHILDREN 0x02000000 Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window. " $GUI = GUICreate("My GUI", 300, 300) ; will create a dialog box that when displayed is centered $btn = Guictrlcreatebutton("Open", 135, 118, 35, 30) $aTest = WinGetPos("My GUI") $GUI2 = GUICreate("Second Winder", $aTest[2], $aTest[3] - 32, $aTest[0] + $aTest[2], $aTest[1], $WS_CAPTION) $edit = GUICtrlCreateEdit($something, 0, 0, $aTest[2], $aTest[3] - 32, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_WANTRETURN, $ES_READONLY), $WS_EX_NOACTIVATE) GUICtrlSetState($edit,$GUI_FOCUS) GUICtrlSetState($btn,$GUI_FOCUS) GUISetState(@SW_HIDE, $GUI2) GUISetState(@SW_SHOW, $GUI) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $btn Then if Not BitAND(WinGetState("Second Winder"), 2) Then GUISetState(@SW_SHOW, $GUI2) Else GUISetState(@SW_HIDE, $GUI2) EndIf EndIf WEnd GUIDelete() EndFunc ;==>Example1 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