Lazarus
Programming => General => Topic started by: pixelink on December 04, 2019, 12:34:11 am
-
I have 1 timer set to "100" interval
All the code handles enabling/disabling buttons and menus based on text in the SynEdit text editor
Most all button/menus handle file saving, cut, copy, past etc
Does anyone know why the menus blink every time the timer fires off?
-
Not sure but my guess is you are doing something to force a redraw every 100ms …
is that really needed ?
-
Well probably you change the state in every OnTimer. That is you set it to the opposite, and then back to what it was.
Off course there is a small chance, that there is an lcl bug, where setting a disabled menu to disabled, will force a redraw....
But why a timer at all?
For copy/paste synedit supports TAction.
But also SynEdit has events, that you can use, and in which you can make the change.
Or if you do not want to make it while the user types, then in the event fire a timer (and reset / re-fire in each further event).
SynEdit.OnStatusChange can tell you when selection is made/lost
SynEdit.OnChange and the ChangeStamp or Modified flag are good for enabling Save.
----------
All else: Show the code in the timer. And mention OS.
-
Well.... it shouldn't be doing it at all.
Anyways... I had to move all my events to other events.
Its a little more complex, but, it did stop it.
Thanks