Recent

Author Topic: Linux alternative to LockWindowUpdate?  (Read 3070 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Linux alternative to LockWindowUpdate?
« on: March 25, 2017, 11:43:10 pm »
Is there such a thing?

I have a small form that I ShowModal over the main form and the top form has multiple dbgrids of most of the same datasets as the main form. When I scroll the smaller upper form, stuff is scrolling below on the main form. I'd like to stop that from visually happening.

For good or bad reasons, in Delphi I used LockWindowUpdate(MainForm) for that. Is there a similar thing for Lazarus/Linux?

Thanks
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Linux alternative to LockWindowUpdate?
« Reply #1 on: March 26, 2017, 07:54:30 am »
as far as I know it doesn't exists. how about disablecontrols of the dataset?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 14393
  • Sensorship about opinions does not belong here.
Re: Linux alternative to LockWindowUpdate?
« Reply #2 on: March 26, 2017, 08:22:19 am »
Or DbGrid.BeginUpdate/EndUpdate. That what it is for.
Too many grids? use this with as parent the form you want to stop updating the grids:
Code: Pascal  [Select][+][-]
  1. procedure UpdateDbGrids(const parent:Tcomponent;StartUpdate:Boolean = true);
  2. var i:integer;
  3. begin
  4.   for i := 0 to parent.ComponentCount -1 do
  5.     if parent.Components[i] is TDbGrid then
  6.       if StartUpdate = true then
  7.         (parent.Components[i] as TDbGrid).BeginUpdate
  8.       else
  9.         (parent.Components[i] as TDbGrid).EndUpdate;
  10. end;  
« Last Edit: March 26, 2017, 09:06:55 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Re: Linux alternative to LockWindowUpdate?
« Reply #3 on: March 26, 2017, 03:24:07 pm »
how about disablecontrols of the dataset?

Thanks, but I had thought of that but then the data is locked also in the subform as DisableControls is global.

I'd need a From-only-scope version for that to work. Is there such a thing?
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Re: Linux alternative to LockWindowUpdate?
« Reply #4 on: March 26, 2017, 03:40:16 pm »
Or DbGrid.BeginUpdate/EndUpdate.

Thanks, but and isn't there all too often a "but," it presents another visual issue, probably a Laz-bug. In the sub-form, if I do an Insert or Edit  to a database, Lazarus clears the top line of the grid in the underlying main form. After a Post/Cancel it does not replace that blank line until I return to the main form.

It is better, but not perfect. :)
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

 

TinyPortal © 2005-2018