Jump to content

Event on call after data entered into input box


Recommended Posts

Hello

first post so please let me know if i missed anything in my question!

I have an input box on a gui control. I want a function to be called as data is entered into the input box, is this possible?

It is intended to act like a filter, so i have a dataset with files names and as the user types data into the box the file list will filter accordingly

FileList

A

B

C

BB

CC

AA

if the user types A then a function will be called to filter the file list to leave

A

AA

I am trying to avoid having a button that requires pressing to activate the filter

Many Thanks for you time and support

Link to comment
Share on other sites

Hello

first post so please let me know if i missed anything in my question!

I have an input box on a gui control. I want a function to be called as data is entered into the input box, is this possible?

It is intended to act like a filter, so i have a dataset with files names and as the user types data into the box the file list will filter accordingly

FileList

A

B

C

BB

CC

AA

if the user types A then a function will be called to filter the file list to leave

A

AA

I am trying to avoid having a button that requires pressing to activate the filter

Many Thanks for you time and support

You need to use $EN_CHANGE which is received through the WM_COMMAND mesage. You could do something like this

;create your gui and your edit. Say the edit is $Ed
:register a function to be called when the message $WM_COMMAND is received
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")


Func _WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
    $nNotifyCode = BitShift($iwParam, 16)
    $nID = BitAND($iwParam, 0x0000FFFF)
    
    If $nNotifyCode = $EN_CHANGE Then
    ;is the change in $Ed?
        If $ilParam <> GUICtrlGetHandle($Ed) Then
            
        ;do something
        EndIf
        
    EndIf

    Return $GUI_RUNDEFMSG
    

EndFunc

Make the ;do something as short as possible. If you need a lot of code which could take a significant time then you might get problems because _WM_COMMAND could get called again while you are executing your code. In this case it is better to set a global varaiable to indicate something has to be done. Then detect the state of this global variable in your main idle loop and do whatever needs to be done, then set the variable back to the 'nothing-to-do' state.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...