![]() |
IOTA-Editor mit sowas wie einem OnChange-Handler?
Hallo,
gibt es eigentlich für das IOTAEditView bzw. für einen dazu äquivalenten Notifier einen Handler mittels dem ich jeweils immer wieder über im TextEditor gemachte Textänderungen informiert werde? Also in etwa das gleiche wie bei einem TRichEdit-Control, wo ich bei einer jeden Textänderung ja auch im OnChange-Handler darauf reagieren kann. Also ungefähr sowas wie einen: (BorlandIDEServices as IOTAEditorServices).TopView.OnChange -Handler? Der IOTANotifier hat zwar so eine Procedure „Modified“, bei der ich aber leider irgendwie nie vorbeikomme. Was ich nicht brauche ist dieses Modified-Flag, was nur erneuert wird, wenn zuvor ein Save-Vorgang ausgeführt wurde. Thx im Voraus |
AW: IOTA-Editor mit sowas wie einem OnChange-Handler?
Ich hatte genau diese Statusinformation auch nicht gefunden und mir mit einem Timer beholfen, der immer den letzten Text mit dem neuen Text vergleicht. Für meine Belange hat es soweit so funktioniert.
Wenn es eine Lösung für das Problem gibt, könnte ich meinen Workaround abschaffen. :-) |
AW: IOTA-Editor mit sowas wie einem OnChange-Handler?
Ich brauche dieses Info, um im TRUE-Fall den dann jeweils neuen Text ins Package rüberzuladen, um dass ich dort den immer gerade aktuellen Text zur Verfügung habe.
Sowas MUSS es doch einfach geben. So eine Allerweltssituation MUSS doch einfach abgedeckt sein. Oder zumindest MÜSSTE!!! |
AW: IOTA-Editor mit sowas wie einem OnChange-Handler?
Delphi-Quellcode:
Der Notifier muss bei IOTAEditorServices registriert werden.
INTAEditServicesNotifier.EditorViewModified
|
AW: IOTA-Editor mit sowas wie einem OnChange-Handler?
Ja, super, danke! Funktioniert!
Ich habe das jetzt mal etwas minimalistisch so abgeleitet/hergeleitet (ausgehend von stahli's TViewPaintNotifier)
Delphi-Quellcode:
unit EditServiceNotifer;
interface uses ToolsAPI, Winapi.Windows, System.Types, Vcl.Graphics, System.Classes, DockForm; type TEditNotifierHelper = class(TInterfacedObject, IOTANotifier, INTAEditServicesNotifier) private public constructor Create; destructor Destroy; override; public // INTAEditServicesNotifier procedure WindowShow(const EditWindow: INTAEditWindow; Show, LoadedFromDesktop: Boolean); procedure WindowNotification(const EditWindow: INTAEditWindow; Operation: TOperation); procedure WindowActivated(const EditWindow: INTAEditWindow); procedure WindowCommand(const EditWindow: INTAEditWindow; Command, Param: Integer; var Handled: Boolean); procedure EditorViewActivated(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); procedure EditorViewModified(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); procedure DockFormVisibleChanged(const EditWindow: INTAEditWindow; DockForm: TDockableForm); procedure DockFormUpdated(const EditWindow: INTAEditWindow; DockForm: TDockableForm); procedure DockFormRefresh(const EditWindow: INTAEditWindow; DockForm: TDockableForm); // IOTANotifier procedure AfterSave; procedure BeforeSave; procedure Destroyed; procedure Modified; end; procedure Register; procedure RemoveNotifier; implementation uses System.SysUtils, Vcl.Dialogs, System.Generics.Collections, readEditorCode_Unit; var NotifierIndex : integer = -1; procedure Register; var Services: IOTAEditorServices; begin Services := BorlandIDEServices as IOTAEditorServices; NotifierIndex := Services.AddNotifier(TEditNotifierHelper.Create); end; procedure RemoveNotifier; var Services: IOTAEditorServices; begin if NotifierIndex <> -1 then begin Services := BorlandIDEServices as IOTAEditorServices; Services.RemoveNotifier(NotifierIndex); NotifierIndex := -1; end; end; { TEditNotifierHelper } constructor TEditNotifierHelper.Create; // Handler funktioniert begin end; destructor TEditNotifierHelper.Destroy; begin inherited; end; //============================================================================== // INTAEditServicesNotifier -Handler procedure TEditNotifierHelper.WindowShow(const EditWindow: INTAEditWindow; Show, LoadedFromDesktop: Boolean); begin end; procedure TEditNotifierHelper.WindowNotification(const EditWindow: INTAEditWindow; Operation: TOperation); begin end; procedure TEditNotifierHelper.WindowActivated(const EditWindow: INTAEditWindow); begin end; procedure TEditNotifierHelper.WindowCommand(const EditWindow: INTAEditWindow; Command, Param: Integer; var Handled: Boolean); begin end; procedure TEditNotifierHelper.EditorViewActivated(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); begin end; procedure TEditNotifierHelper.EditorViewModified(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); begin Winapi.Windows.beep(1000,100); // Handler funktioniert ! ! ! ! ! end; procedure TEditNotifierHelper.DockFormVisibleChanged(const EditWindow: INTAEditWindow; DockForm: TDockableForm); begin end; procedure TEditNotifierHelper.DockFormUpdated(const EditWindow: INTAEditWindow; DockForm: TDockableForm); begin end; procedure TEditNotifierHelper.DockFormRefresh(const EditWindow: INTAEditWindow; DockForm: TDockableForm); begin end; //============================================================================== procedure TEditNotifierHelper.AfterSave; begin end; procedure TEditNotifierHelper.BeforeSave; begin end; procedure TEditNotifierHelper.Destroyed; begin end; procedure TEditNotifierHelper.Modified; begin end; initialization finalization RemoveNotifier; end. |
AW: IOTA-Editor mit sowas wie einem OnChange-Handler?
Super, vielen Dank!
Dann kann ich das auch mal noch mit einbauen. :thumb: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz