Jump to content

Notification of clicking on edit


Inververs
 Share

Recommended Posts

  • Moderators

Odin,

I have never found a way of registering a click on an input control. The best I have come up with is to use "Enter" to indicate that the data entry is complete - as you are probably using the keyboard to enter the data in the first place, it is not too much of a restriction: :mellow:

#include <GUIConstantsEx.au3>

Main()

Func _Main()

    $hGUI = GUICreate("Test", 500, 500)

    Local $hInput = GUICtrlCreateInput('', 10, 10, 200, 20)

    GUISetState()

    ; Set an accelerator key to mark the end of the data input
    Local $hDum = GUICtrlCreateDummy()
    Local $accels[1][2] = [["{ENTER}", $hDum]]
    GUISetAccelerators($accels)

    While 1
        Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hDum
            MsgBox(0,"Input Ready", GUICtrlRead($hInput))
        EndSwitch
    WEnd

EndFunc   ;==>_Main

I hope this helps.

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

  • Moderators

Odin,

I say again:

I have never found a way of registering a click on an input control.

M23

Edit: But someone else might. :mellow:

Edited by Melba23

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

This is actually pretty easy. There's two methods I can think of:

1) Monitor the EN_SETFOCUS notification, which is sent to the parent window via WM_COMMAND. So, GuiRegisterMsg($WM_COMMAND... However this will not work if the input control already has focus (or is the only control in the GUI). If you have more controls and focus is being moved to the input and you really only need this notification one time, then this is certainly viable and would be my first choice.

2) Check for the $GUI_EVENT_PRIMARYDOWN or $GUI_EVENT_PRIMARYUP event using GUIGetMessage in advanced mode or GUIOnEventMode with GUIGetCursorInfo to find out what control the mouse has clicked.

Edited by wraithdu
Link to comment
Share on other sites

  • Moderators

wraithdu,

I like the second way - but it is a bit roundabout.

Although you seem to be specialising in that sort of code lately! :mellow:

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

All thanks.

I did so:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 232, 184, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYUP
            $aMouse_Info=GUIGetCursorInfo ( $Form1 )
            Switch $aMouse_Info[4]
                Case $Input1
                    MsgBox(0,0,"Click")
                Case Else
            EndSwitch
    EndSwitch
WEnd
Edited by Odin
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...