Recent

Author Topic: Extended DBGrid  (Read 4097 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Extended DBGrid
« on: June 06, 2019, 09:29:16 am »
Hi guys, I'm extending the dbgrid to get a smarter grid that allows me to have filters in the columns and other features. I'm at the beginning and the project is still at the beginning. But I have already encountered a problem. If you compile my project and run it you will see that it loads two lines in the grid, then if you click on the Click Me button you will notice that the grid redraw is wrong, the size of the row containing the titles and filters gets smaller. Then, if you click with the mouse on any point on the grid, it redraws correctly. I don't understand why I have to click to see right. If you look at the images I attach you will understand what I mean.

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 #1 on: June 06, 2019, 09:41:31 am »
To simplify the problem occurs when I close and reopen the dataset that populates the grid. If you create a button2 and put the following code in it

     Self.Q_Persone.Close;
     Self.Q_Persone.Open; 

you will see that you replicate the error. But I don't understand why. Is it a bug in the dbgrid? Or do I have a problem with my code? Do you miss anything?
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 #2 on: June 06, 2019, 02:43:39 pm »
Has anyone managed to reproduce the problem?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

nouzi

  • Sr. Member
  • ****
  • Posts: 296
Re: Extended DBGrid
« Reply #3 on: June 06, 2019, 06:02:21 pm »
error  sql query is empty
My English is  bad
Lazarus last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #4 on: June 06, 2019, 10:42:46 pm »
error  sql query is empty

Impossible, I rediscovered it and it doesn't give me the error you say.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Extended DBGrid
« Reply #5 on: June 06, 2019, 10:46:13 pm »
On Windows 10 it works fine.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #6 on: June 06, 2019, 10:55:10 pm »
Problem only on Mac cocoa
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Extended DBGrid
« Reply #7 on: June 07, 2019, 02:07:18 am »
Problem only on Mac cocoa

What version of Lazarus are you using? 1.8.0?
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #8 on: June 07, 2019, 07:32:09 am »
Problem only on Mac cocoa

What version of Lazarus are you using? 1.8.0?
2.1.0
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 #9 on: June 07, 2019, 12:28:13 pm »
Look at the example below. Click the "click me" button and then the "click me 2" button. If you see the click me 2 performs an operation that I also perform in the click me. I don't understand why clicking on "click me 2" works.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Extended DBGrid
« Reply #10 on: June 07, 2019, 12:45:37 pm »
I don't understand why clicking on "click me 2" works.
Because you do a whole lot more in "Click me".

So what is the problem.
Why not just step through all the things you do in "Click me" and see where the problems lies.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #11 on: June 07, 2019, 01:34:04 pm »
I can't understand what's wrong. First because on windows and linux it works but only on mac no, second because it seems that any subsequent iteration with the grid on click me redraws the grid itself correctly. And I don't understand what prevents him from doing it directly in the click me button.
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 #12 on: June 07, 2019, 10:19:50 pm »
Ok, I modified the program slightly. Ignore the click me button and the click me2 button. After loading, first click the Button3 button and you will see that I only do a DataSet.Close and a DataSet.Open and a DataSet.Refresh (and so far the problem presents itself). Then press the button4 button and you will see that the problem is solved. But it doesn't make sense, because in button4 I only do a DataSet.refresh. I would like to know which user writes cocoa widgets so as to ask him directly how to solve.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Extended DBGrid
« Reply #13 on: June 09, 2019, 02:40:24 am »
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.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Extended DBGrid
« Reply #14 on: June 09, 2019, 10:42:50 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?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018