Editorgadget undo?
Editorgadget undo?
Hello!
Does anyone know if editorgadget undo flag could temporary be suppressed, so that you could make some changes to text and then
unsuppress undo flag back again.
Reason for this is that I need a simple highlighter for editorgadget, but highlighting shouldn't be recorded to undo list...
Or is there some other way to do this?
Thanks
Timo
Does anyone know if editorgadget undo flag could temporary be suppressed, so that you could make some changes to text and then
unsuppress undo flag back again.
Reason for this is that I need a simple highlighter for editorgadget, but highlighting shouldn't be recorded to undo list...
Or is there some other way to do this?
Thanks
Timo
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Editor_0
#Button_0
#Button_1
#Button_2
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 408, 205, 413, 277, "Undo Test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
EditorGadget(#Editor_0, 10, 10, 390, 220)
ButtonGadget(#Button_0, 10, 240, 80, 30, "Undo")
ButtonGadget(#Button_1, 100, 240, 80, 30, "Edit Text")
ButtonGadget(#Button_2, 190, 240, 80, 30, "Edit Text 2")
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
GadgetID = EventGadget()
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
SendMessage_(GadgetID(#Editor_0), #EM_UNDO, 0, 0)
ElseIf GadgetID = #Button_1
SetGadgetText(#Editor_0, "I love Purebasic")
ElseIf GadgetID = #Button_2
SetGadgetText(#Editor_0, GetGadgetText(#Editor_0) + Chr(13) + Chr(10) + "Another Test")
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
End

PS: Try edit some text manually and see...
@milan1612,
try this:
Using SetGadgetText() on EditorGadget, seems to empty undo-buffer, and thats the main problem here, or do I understand this wrong?
Timo
try this:
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Editor_0
#Button_0
#Button_1
#Button_2
#Text_1
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 408, 205, 413, 277, "Undo Test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
EditorGadget(#Editor_0, 10, 10, 390, 220)
ButtonGadget(#Button_0, 10, 240, 80, 30, "Undo")
ButtonGadget(#Button_1, 100, 240, 80, 30, "Edit Text")
ButtonGadget(#Button_2, 190, 240, 80, 30, "Edit Text 2")
TextGadget(#Text_1, 280, 240, 100, 20, "")
EndIf
EndIf
EndProcedure
Open_Window_0()
SetGadgetText(#Editor_0, "")
Repeat
Event = WaitWindowEvent()
GadgetID = EventGadget()
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
SendMessage_(GadgetID(#Editor_0), #EM_UNDO, 0, 0)
ElseIf GadgetID = #Button_1
SetGadgetText(#Editor_0, "I love Purebasic")
ElseIf GadgetID = #Button_2
SetGadgetText(#Editor_0, GetGadgetText(#Editor_0) + Chr(13) + Chr(10) + "Another Test")
EndIf
EndIf
If SendMessage_(GadgetID(#Editor_0),#EM_CANUNDO, 0, 0) = #True
SetGadgetText(#Text_1, "CAN UNDO")
Else
SetGadgetText(#Text_1, "CAN'T UNDO")
EndIf
Until Event = #PB_Event_CloseWindow
End
Timo
Try my code example here: http://www.purebasic.fr/english/viewtop ... 517#161517
quidquid Latine dictum sit altum videtur
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany