xtrim Posted May 24, 2011 Posted May 24, 2011 Hi,I'm trying to write a program that displays text and there is a find box above it.So far so good.What i am trying to do is only while I'm inside the find box the isPressed() functionsis being called to perform its find procedure in the text.What I am not able to do so far is to figure if i'm in the input box or not....any command that I'm missing here like "isthisControlActive"?tnx
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 xtrim,I would recommend a look at _WinAPI_GetFocus (Retrieves the handle of the window that has the keyboard focus). Or you might like to look for the $EN_CHANGE message that is sent when you modify the content of an input - like this:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Input Monitor", 300, 50, -1, -1) Global $hInput = GUICtrlCreateInput("", 5, 15, 290) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) ; LoWord Local $iCode = BitShift($wParam, 16) ; HiWord If $iIDFrom = $hInput And $iCode = $EN_CHANGE Then ConsoleWrite("The Input was modified and now reads: " & GUICtrlRead($hInput) & @CRLF) EndIf EndFunc;==>_WM_COMMANDPlease ask if anything is unclear. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
xtrim Posted May 24, 2011 Author Posted May 24, 2011 (edited) tnx guys Melba23, Your solution seems to work I don't really understand it...but it is working... Can you comment on what you did? Edited May 24, 2011 by xtrim
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 xtrim,Read the GUIRegisterMsg tutorial in the Wiki. Come back if you still have questions. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
UEZ Posted May 24, 2011 Posted May 24, 2011 Look in the help file for GUIRegisterMsg to get a detailed description for GUIRegisterMsg() function. $wParam is the first message parameter as hex value which will be splitted to high and low word. The low word of $wParam contains, among other things, the GUI ids which will be saved to $iIDFrom. The hi word saves the changes made to the controls - here to $iCode. If the control is the inputbox and when the user has taken an action that may have altered text in the inputbox control then print to console. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
xtrim Posted May 24, 2011 Author Posted May 24, 2011 (edited) One more question (or 2), How do I set the focus back on the input box once the Selection in the text was made? And is there and easy way to replace text in RichEditBox? Edited May 24, 2011 by xtrim
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now