Recent

Author Topic: [Solved] Form update  (Read 3041 times)

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
[Solved] Form update
« on: June 14, 2018, 12:49:11 am »
Due to my programming is have a very nasty screen flicker when I am updating my screen.
I have search the forum but I can't find any relevant topics on this (maybe it's just me).


But is it possible to 'disable' the form , update your form and then show the updated form?
« Last Edit: June 14, 2018, 11:24:37 am by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: Form update
« Reply #1 on: June 14, 2018, 12:50:57 am »
No, is not just you. If you change a lot of UI elements it becomes slow.

You can try using BeginUpdate and EndUpdate in those controls that has it.

Another way is to Enabled := False, then in a try.. finally part enable it again.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Form update
« Reply #2 on: June 14, 2018, 11:24:22 am »
After fooling around with my code I came to the following solution.
The parts that flickered the most I put in a GroupBox or Panel.
I disabled the visibility, updated the components and then put the visibility back.
No more flickering from updating components.


It's not ideal, but effective.
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: [Solved] Form update
« Reply #3 on: June 14, 2018, 07:05:00 pm »
I understand that. I had to do the same for a project that heavily uses UI.

 

TinyPortal © 2005-2018