Recent

Author Topic: [SOLVED] Quick Q - Not Getting Correct Data When Selecting Cell/Row  (Read 295 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Got a weird issue and not sure what gives.

Using StringGrid.
I have 1 fixed row (header) - 3 Columns (one is Grid Button)
2 Rows of actual data

When using the grid button, it returns the data fine of the appropriate row data.

But when using event "OnSelectCell"

It retuns the wrong data.

So, if I click on a cell in row 1, it teturns data from row 2
And visa-versa - Returns data from row 1 if I click on cell in row two.

Again... using same code, it works fine on the grid button

CODE:

Code: Pascal  [Select][+][-]
  1. lbStatus.Caption:=StringGrid1.Cells[2,StringGrid1.Row]+ '\';

What is going on?

Thanks for any help.
« Last Edit: July 02, 2020, 10:16:48 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

jamie

  • Hero Member
  • *****
  • Posts: 3648
Re: Quick Q - Not Getting Correct Data When Selecting Cell/Row
« Reply #1 on: July 02, 2020, 09:27:37 pm »
miss use of the event I am afraid..

 If you look you have aCOL, AROW etc..

and a Boolean;;

 The ACOL and aROW is the cell you just clicked into
the Boolean allows you to instruct the grid to accept it.

 but in this case if you need to use it directly you use the indexes given to you in the event call not from the class body
The only true wisdom is knowing you know nothing

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Quick Q - Not Getting Correct Data When Selecting Cell/Row
« Reply #2 on: July 02, 2020, 10:04:34 pm »
miss use of the event I am afraid..

 If you look you have aCOL, AROW etc..

and a Boolean;;

 The ACOL and aROW is the cell you just clicked into
the Boolean allows you to instruct the grid to accept it.

 but in this case if you need to use it directly you use the indexes given to you in the event call not from the class body

Okay, I mostly get it.
So, how do i fix it so that I am reference the correct row (col - row)?
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

jamie

  • Hero Member
  • *****
  • Posts: 3648
Re: Quick Q - Not Getting Correct Data When Selecting Cell/Row
« Reply #3 on: July 02, 2020, 10:10:02 pm »
Hmm
in the OnSelectCell event;
Code: Pascal  [Select][+][-]
  1. lBStatus.caption := StringGrid1.Cells[2, AROW] +'\';
  2.  
The only true wisdom is knowing you know nothing

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Quick Q - Not Getting Correct Data When Selecting Cell/Row
« Reply #4 on: July 02, 2020, 10:16:35 pm »
Hmm
in the OnSelectCell event;
Code: Pascal  [Select][+][-]
  1. lBStatus.caption := StringGrid1.Cells[2, AROW] +'\';
  2.  

Oh, I knew that... I just for got about it.

Thanks for the help Jamie
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

 

TinyPortal © 2005-2018