[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Supress TextEditor Change event


On Tue, 10 Sept 2024 at 09:55, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> Le 10/09/2024 à 03:36, Bruce Steers a écrit :
> >
> >
> > On Mon, 9 Sept 2024 at 18:07, Bruce Steers <bsteers4@xxxxxxxxx
> > <mailto:bsteers4@xxxxxxxxx>> wrote:
> >
> >     On Mon, 9 Sept 2024 at 17:42, Bruce Steers <bsteers4@xxxxxxxxx
> >     <mailto:bsteers4@xxxxxxxxx>> wrote:
> >
> >         I have the following code..
> >
> >         I'm currently working around it by using my own lock variable so
> >         i set like this.
> >         $bFreezeEditor = True
> >         SetProp(TextEditor1, "Text", sText)  ' SetProp Locks object,
> >         sets prop, then unlocks
> >         Wait  ' let that timer trigger
> >         $bFreezeEditor = True  ' OOPS
> >
> >     of course i meant False in that last line :-\
> >     BruceS
> >
> >
> > I've now fixed it by saving this as TextEditor.class in my .src
> >
> > ' Gambas class file
> >
> > Export
> >
> > Public Sub _RaiseChange()
> >
> >    If Object.IsLocked(Me) Then Return
> >    Super._RaiseChange
> >
> > End
> >
> > Now it does not trigger Change event if locked
> >
> > Respects
> >
>
> Yes, it's because 'Change' event is postponed, to avoid raising it for
> each single change.
>
> Regards,
>
>
> --
> Benoît Minisini.
>

Aah I see, I never noticed it before but it explains a bug in my IDE
ExternalTools feature that has escaped me for a while where it is set to
save config changes on Change event.
but not if Locked when I'm loading fresh data.
I was finding that sometimes the text of one item would overwrite the text
of another for some unknown reason. (very annoyingly)
Makes sense it could be because of the unexpected Change event triggering
when locked and loading new data.

I think I'd call this a bug. Object.Lock is supposed to stop event triggers
yes?


Respects
BruceS

Follow-Ups:
Re: Supress TextEditor Change eventBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
Supress TextEditor Change eventBruce Steers <bsteers4@xxxxxxxxx>
Re: Supress TextEditor Change eventBruce Steers <bsteers4@xxxxxxxxx>
Re: Supress TextEditor Change eventBruce Steers <bsteers4@xxxxxxxxx>
Re: Supress TextEditor Change eventBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>