Input vs Edit control

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
Hi,

Remembering old discussion topic about input control events I've 
written new script which shows difference between Input and Edit 
events:

; Both includes are required
#include <GUIConstants.au3>

; Set up a basic test GUI
$hWnd = GUICreate("Input vs Edit", 400, 150)
$LabelOfEdit = GUICtrlCreateLabel("Edit control is fired by {Enter}, 
only", 10, 10, 380, 21)
$Edit = GUICtrlCreateEdit("", 10, 30, 380, 21, BitOR
($ES_WANTRETURN,$ES_AUTOVSCROLL))
$LabelOfInput = GUICtrlCreateLabel("Input control is fired by any 
focus changes incl. {Tab}", 10, 50, 380, 21)
$Input = GUICtrlCreateInput("", 10, 70, 380, 21)

GUISetState()

; Start the main loop
While 1
   $EditContent = GUICtrlRead($Edit)
   If StringRight($EditContent,2) = @CRLF Then
     $EditContent = StringTrimRight($EditContent,2)
     WinSetTitle($hWnd, "", $EditContent)
     GUICtrlSetData($Edit,$EditContent)
   endif        
   $iMsg = GUIGetMsg()
   Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input
            WinSetTitle($hWnd, "", GUICtrlRead($Input))
    EndSwitch
WEnd

You can see that Edit control is refreshing window title by {Enter} 
key but Input does the same action by any {Enter}, {Tab}, or after 
focus loss.
The cost of Edit control advance is polling of it's content.

Valery
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.