Recent

Author Topic: Extended DBGrid  (Read 4152 times)

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: Extended DBGrid
« Reply #15 on: June 09, 2019, 10:49:31 pm »
I would like to know which user writes cocoa widgets so as to ask him directly how to solve.
Not sure about DBGrid, but most likely skalogryz.
I do not understand what you mean. what is skalogryz?!
You asked for a user.
skalogryz is a forum-user.
Check his profile.
https://forum.lazarus.freepascal.org/index.php?action=profile;u=13884
Quote
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz
« Last Edit: June 09, 2019, 10:51:27 pm by rvk »

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #16 on: June 10, 2019, 08:11:48 am »
thanks a lot
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #17 on: June 10, 2019, 07:05:55 pm »
Example done for skalogryz. See attachment
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Extended DBGrid
« Reply #18 on: June 10, 2019, 07:53:57 pm »
so what's happening is that on the initial drawing your first row height is 21 pixels. (which is a default row height).
On the consequent drawing, the desired 42-pixels height is picked up.

You don't really need to do ".Refresh" of any kind. You can just simply resize the form to see the height of the top row to change.

What you're looking into is resetting the height of the first row before (the first) drawing.
Currently, the height is adjusted in DrawCell() method, and that's too late. (as drawing is already in progress)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #19 on: June 11, 2019, 08:09:50 am »
so what's happening is that on the initial drawing your first row height is 21 pixels. (which is a default row height).
On the consequent drawing, the desired 42-pixels height is picked up.

You don't really need to do ".Refresh" of any kind. You can just simply resize the form to see the height of the top row to change.

What you're looking into is resetting the height of the first row before (the first) drawing.
Currently, the height is adjusted in DrawCell() method, and that's too late. (as drawing is already in progress)

So in which event do you advise me to move the definition of the title height?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Extended DBGrid
« Reply #20 on: June 11, 2019, 02:40:10 pm »
So in which event do you advise me to move the definition of the title height?
there are two places that can work
1) whenever you change a filter setting (as filters are the reason for the height to be different). If filter change, you'd need to review if the height needs to be any different than default height.
2) in the very most beginning of the paint. Before you pass the paint to TDBGrid, you need to adjust heights according to the current filter settings.

Approach #1 is better, than approach #2. Both of them would be doing the same thing (checking if height needs to be different).
But approach #1 would only do it when the height can actually change.
Approach #2 would do it every time the control paints. And that is a little of overhead.

 

TinyPortal © 2005-2018