[SOLVED] Knowing When Text Changed
-
- Addict
- Posts: 1059
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
[SOLVED] Knowing When Text Changed
How does NotePad or any other app know if text was changed? Even as little as one character, it always seems to know.
Last edited by Randy Walker on Sun Aug 03, 2025 10:12 pm, edited 1 time in total.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 1059
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: Knowing When Text Changed
Wow! Thanks infratec. So much more complex than I imagined.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
Re: [SOLVED] Knowing When Text Changed
For your own apps, you can use #PB_EventType_Change for some gadgets to know when they've changed, or use GetGadgetText() and compare it with a previous GetGadgetText() to see if the text differs.
To detect changes in third-party apps like Notepad, you'd need to parse its window to get all its "gadgets" and then check the one with the "Edit" class (similar to what I said about GetGadgetText() above).
To detect changes in third-party apps like Notepad, you'd need to parse its window to get all its "gadgets" and then check the one with the "Edit" class (similar to what I said about GetGadgetText() above).
Re: [SOLVED] Knowing When Text Changed
Even if the post is marked as solved.
For completeness, there are also the API functions under Windows that can upgrade an EditorGadget() ....
A small extract to answer the above question:
For completeness, there are also the API functions under Windows that can upgrade an EditorGadget() ....
A small extract to answer the above question:
Code: Select all
; query the EditorGadget for modified text since last reset
;
Macro EditorGadget_IsModified(Gadget)
SendMessage_(GadgetID(Gadget), #EM_GETMODIFY, #Null, #Null)
EndMacro
; reset EditorGadget modify flag
;
Macro EditorGadget_ResetModified(Gadget)
SendMessage_(GadgetID(Gadget), #EM_SETMODIFY, #False, #Null)
EndMacro
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
-
- Addict
- Posts: 1059
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: [SOLVED] Knowing When Text Changed
Thanks Axolotl... And looks so much simpler too.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 1059
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: [SOLVED] Knowing When Text Changed
Hadn't considered it might be detected by EventType() so that's a really great tip!!BarryG wrote: Mon Aug 04, 2025 12:15 am For your own apps, you can use #PB_EventType_Change for some gadgets to know when they've changed...
Well yeah that's the obvious way, but bothersome.or use GetGadgetText() and compare it with a previous GetGadgetText() to see if the text differs.
Good info, but way outside of my interest. just wanted to know about changes to editor and string gadgets.To detect changes in third-party apps like Notepad, you'd need to parse its window to get all its "gadgets" and then check the one with the "Edit" class (similar to what I said about GetGadgetText() above).
THANKS BarryG!!!
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
Re: [SOLVED] Knowing When Text Changed
Was detecting the change for your own app, or for third-party apps? Because you only mentioned Notepad (third-party).
-
- Addict
- Posts: 1059
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: [SOLVED] Knowing When Text Changed
Was thinking of my own app and using NotePad as an example of an app that exhibits that feature. Sorry for confusion and not being more explicit.BarryG wrote: Mon Aug 04, 2025 10:56 pm Was detecting the change for your own app, or for third-party apps? Because you only mentioned Notepad (third-party).
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.