Hello Folks,
I'm not an AutoIt noob but I am new to the GuiRegisterMsg command.
What I am trying to do is to pop up a "long string edit" window when user double-clicks. Ideally I wanted it to be a duouble-click in the Input box itself but I couldn't get this to work so I was going to settle for a double-click *near* the input box.
Here's a severely curtailed version of my almost 1300-line script. From the msgbox "tell-tale" it appears that the GuiRegisterMsg definition interferes with the GuiGetMsg function and it 'remembers' the last GuiGetMsg return value -- is there some way to 'flush' the holding area? Note that there are bits in there from experiments -- if I comment out the While-Wend and replace it with the sleep line you can better see what I am trying to acheive. The list box is just to give a different kind of control than an input field to have the focus, it's contents are not relevant to the snippet, only to the full app.
All help gratefully acknowledged! Here's the code snippet:
I'm not an AutoIt noob but I am new to the GuiRegisterMsg command.
What I am trying to do is to pop up a "long string edit" window when user double-clicks. Ideally I wanted it to be a duouble-click in the Input box itself but I couldn't get this to work so I was going to settle for a double-click *near* the input box.
Here's a severely curtailed version of my almost 1300-line script. From the msgbox "tell-tale" it appears that the GuiRegisterMsg definition interferes with the GuiGetMsg function and it 'remembers' the last GuiGetMsg return value -- is there some way to 'flush' the holding area? Note that there are bits in there from experiments -- if I comment out the While-Wend and replace it with the sleep line you can better see what I am trying to acheive. The list box is just to give a different kind of control than an input field to have the focus, it's contents are not relevant to the snippet, only to the full app.
All help gratefully acknowledged! Here's the code snippet:
#include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <ListBoxConstants.au3> Dim $InputFileId Dim $OutputFileId Dim $winMain Dim $GUIMsg GUIRegisterMsg($WM_LBUTTONDBLCLK, "EditText") $winMain = GUICreate ("Test for Editing Long Strings", 800, 560, -1, -1) GUICtrlCreateLabel("File to Process", 22,30) GUICtrlCreateLabel("Output File", 40,60) $InputFileId = GUICtrlCreateInput ( "", 100, 25, 400, 20) $OutputFileId = GUICtrlCreateInput ( "", 100, 55, 400, 20) $btnInputFile = GUICtrlCreateButton ( "Browse for File", 520, 22, 110, 25) $btnOPFolder = GUICtrlCreateButton ( "Browse for Location", 520, 53, 110, 25) ; Create the list of actions $ActionList = GUICtrlCreateList( "", 25, 260, 70, 200) GUICtrlSetData($ActionList, "Delete|Exclude|Include|Insert|Kill Blanks|Move|Remove|Replace|Switch", "Delete") GUISetState(@SW_SHOW, $winMain) While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop Case $btnInputFile MsgBox(0, "Info", "Input Button pressed") Case $btnOPFolder MsgBox(0, "Info", "Output Button pressed") EndSwitch WEnd Func EditText($Window, $Caller, $p1, $p2) Dim $winEdit Dim $CtrlName Dim $edtString Dim $btnAccept Dim $btnReject Dim $Response Dim $RetString Dim $CtrlId Dim $ActCode Dim $HasFocus $CtrlName = ControlGetFocus("Test for Editing Long Strings") msgbox(0,"DOUBLE-CLICK!","Control: " & $CtrlId & @CRLF & "Action: " & $ActCode & @CRLF & "CtrlName: " & $CtrlName) If StringInStr($CtrlName,"Edit") > 0 Then $winEdit = GUICreate("Long String Editor", 790, 100, -1, -1, $WS_BORDER) $edtString = GUICtrlCreateEdit("This is a potentially long string", 5, 5, 780, 20, $ES_AUTOHSCROLL) $btnAccept = GUICtrlCreateButton( "Accept String", 240, 33, 100, 30) $btnReject = GUICtrlCreateButton( "Reject String", 440, 33, 100, 30) GUISetState(@SW_SHOW, $winEdit) GUICtrlSetState($edtString, $GUI_FOCUS) ; sleep(5000) ;#cs While 1 $Response = GUIGetMsg() if $Response = $btnAccept Then ExitLoop EndIf Select Case $Response = $btnReject ExitLoop Case $Response = $btnAccept ; GUICtrlSetData($CtrlName, $RetString) ExitLoop Case Else $RetString = GUICtrlRead($edtString) EndSelect WEnd ;#ce Else Return $GUI_RUNDEFMSG EndIf GUICtrlSetData($CtrlName, $RetString) GUIDelete($winEdit) Return $GUI_RUNDEFMSG EndFunc