Jump to content

how do you error check with edit control?


JAFN
 Share

Recommended Posts

I know I am probably missing the obvious again.

I need a way to determine if an edit control's text has changed so that I can perform some restriction routines.

I have found how to catch each keystroke but that really doesn't help.

I assume it has something to do with losing focus. But the edit control seems to have few commands available.

If someone could point me in the right direction it would be most appreciated.

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

  • Moderators

JAFN,

Search the forum for a message handler dealing with the $EN_CHANGE message - this is sent when the content of an edit changes. :)

And if that sounds like Chinese, then I recommend reading the GUIRegisterMsg tutorial in the Wiki first. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Wow I don't think so short a tutorial as ever caused me such a headache. Way way over my current understanding level.

But $EN_CHANGE despite zero documentation does make sense to me.

Now just have to make it work on the whole instead of letter by letter. But I have thoughts on how to do that.

Thanks again for your time.

Oh, and any time I said 'edit' I meant 'input'

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

  • Moderators

JAFN,

An Input control is just a special case of an Edit control - so the $EN_CHANGE message is still valid. :)

Please do ask about the problems you had understanding the tutorial - we are here to try and help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Please do ask about the problems you had understanding the tutorial - we are here to try and help. :)

M23

Appreciated, but that tutorial was jumping way ahead in my learning curve. It might well have been written in Japanese.

At some future date I will take you up on that.

But I am sure I will be back many times before then :)

Thanks

[size="2"]The second mouse gets the cheese[/size]
Link to comment
Share on other sites

Check this example:

#include <WinAPI.au3>
Global $EN_CHANGE = 0x300
Global $MAIN, $EDIT

$MAIN = GUICreate("Example")
$EDIT = GUICtrlCreateEdit("",5,5,390,390,0x00200000)
GUISetState(@SW_SHOW,$MAIN)
GUIRegisterMsg(0x0111,"WM_COMMAND")

While True
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
    Sleep(10)
WEnd

Func WM_COMMAND($hWnd,$Msg,$wParam,$lParam)
    If $hWnd = $MAIN Then
         If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WINAPI_LoWord($wParam) = $EDIT Then
             TrayTip("NOTIFY","Something was changed in EditBox",1)
         EndIf
    EndIf
EndFunc
Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...