Dear All,
I have a programme that shows records in a couple of editor fields. The user can change the text in the fields.
What I would like to do is to signal to the user that he has changed the text by changing the background colour.
Just now I can think of two ways of doing it.
1. record content then use a timer that compares the recorded with the present content every 0.5s
2. record content then use EventGadget for the editorfields to indicate that something has happened, compare texts as above
However both seem to have their disadvantages:
1. seems like a waste of resources and will continue running even when the programme is in the background (this could be solved if there is a Window - lostfocus, but I can't find one)
2. this is evoked for any number of reasons, not all are related to changes in the text
Is there a smart(er) way of doing it?
all the best / Björn
Indicate change in text
Re: Indicate change in text
Windows only:
EM_GETMODIFY
EM_GETMODIFY
Re: Indicate change in text
Nice, but do you know anything about the reliability? At least someone seems to have had problems with it...
http://msdn.microsoft.com/en-us/library ... s.85).aspx
http://msdn.microsoft.com/en-us/library ... s.85).aspx
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Re: Indicate change in text
Code: Select all
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #String_minutes
If EventType = #PB_EventType_Change ; <---- DING DING
Do extra check to see if it is equal to last value
etc....
EndIf
EndIf
-
- Addict
- Posts: 4793
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Indicate change in text
I use #PB_Event_Gadget together with #PB_EventType_Change:BjornF wrote:[EventGadget] is evoked for any number of reasons, not all are related to changes in the text
Is there a smart(er) way of doing it?
Code: Select all
event = WaitWindowEvent()
If event = #PB_Event_Gadget
Select EventGadget()
Case #MyEditField
Select EventType()
Case #PB_EventType_Change
; do something
EndSelect
[...]
Regards, Little John
//edit: Num3 was some seconds faster.

Re: Indicate change in text
Excellent !
Thank you for the help, just the thing I was after. / Björn
edit: I just tried it, and couldn't get it to work
Did you try it? (Editorgadget isn't noted as one of the gadgets it can be used on)

Thank you for the help, just the thing I was after. / Björn
edit: I just tried it, and couldn't get it to work



Did you try it? (Editorgadget isn't noted as one of the gadgets it can be used on)
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Re: Indicate change in text
Upsss you forgot to mention it was for an editor gadget!BjornF wrote:Excellent !![]()
Thank you for the help, just the thing I was after. / Björn
edit: I just tried it, and couldn't get it to work![]()
![]()
![]()
Did you try it? (Editorgadget isn't noted as one of the gadgets it can be used on)
I don't think it will work with that

-
- Addict
- Posts: 4793
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Indicate change in text
Ooops ...
For an EditorGadget, use this code (slightly modified for recent PB versions after a code by srod):
Regards, Little John
For an EditorGadget, use this code (slightly modified for recent PB versions after a code by srod):
Code: Select all
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133)
;Add the following line to enable the editor gadget to send #EN_CHANGE notifications.
SendMessage_(GadgetID(0), #EM_SETEVENTMASK, 0, SendMessage_(GadgetID(0), #EM_GETEVENTMASK, 0,0)|#ENM_CHANGE)
For a = 0 To 5
AddGadgetItem(0, a, "Line " + Str(a))
Next
Repeat
Event = WaitWindowEvent()
Select EventType()
Case #PB_EventType_Change
Debug "changed"
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
Re: Indicate change in text
Thank you, I'll have a go with that one. / all the best, Björn