Recent

Author Topic: TDBGrid CellClick problem  (Read 5187 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2258
    • Lazarus and Free Pascal italian community
TDBGrid CellClick problem
« on: April 20, 2010, 07:33:06 am »
Then I ask a question, because when a TDBGrid connected to a DBF file if I click on a cell moves me more often displaying the grid at the bottom!  :o
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

christensen

  • Full Member
  • ***
  • Posts: 127
Re: TDBGrid CellClick problem
« Reply #1 on: May 04, 2010, 04:48:20 pm »
i don't know if i understand the question, so you get the result from the bottom of the grid?the last records from database?
how you make to display the records from grid?

which of them use:
Code: [Select]
TDBGrid.SelectedField.DisplayText;
or

Code: [Select]
SQLQuery.Fields[0].asString;
both are displaying some records, the first one display the clicked cell value, which if you have more cells will represent a problem because after select you need to compare all fields to make another query and can make mistake in case if the same record is stored in different fields.
the only way to make it unique is to use the primary field (ID) and this you can achieve whit
Code: [Select]
SQLQuery.Fields[0].asString; or
Code: [Select]
SQLQuery.FieldByName('id').AsString
i hope i understand your question.
Lazarus 1.4.4, FPC 2.6.4, Windows 7 64bit, AMD Athlon 7750 black edition, Asus M3N78-CM
Lenovo L540 i7-4702MQ, Windows 10 x64,Lazarus 1.6.2,FPC 3.0

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: TDBGrid CellClick problem
« Reply #2 on: May 04, 2010, 08:58:52 pm »
Then I ask a question, because when a TDBGrid connected to a DBF file if I click on a cell moves me more often displaying the grid at the bottom!  :o

Please submit a bug report with a sample project.

 

TinyPortal © 2005-2018