Board index » cppbuilder » StringGrid Selection

StringGrid Selection


2007-02-26 02:42:33 PM
cppbuilder71
Hi,
I've created a TMyStringGrid. I have set one Fixed Row and one Fixed Col
in the application. I'd like to be able to click on a cell on the
first column (the fixed Col) to select a row, but TStringGrid does not
response to fixed cell mouse click. What do I need to do to have a row
selected after click on a fix column?
Thanks
-Bill
 
 

Re:StringGrid Selection

Bill wrote:
Quote
... but TStringGrid does not
response to fixed cell mouse click.
Then that is a question for
borland.public.cppbuilder.vcl.components.using
Use the OnMouseDown event instead.
Hans.
 

Re:StringGrid Selection

"Bill" < XXXX@XXXXX.COM >wrote in message
Quote
TStringGrid does not response to fixed cell mouse click.
Yes, it does. There is simply nothing for it to do because the cell
is fixed, so there is no OnSelectCell or OnClick event triggered.
Quote
What do I need to do to have a row selected after click on a fix
column?
Use the OnMouseDown/Up event, ie:
void __fastcall TForm1::StringGrid1MouseDown(TObject* Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
int Col, Row;
StringGrid1->MouseToCell(X, Y, Col, Row);
if( Col == 0 )
StringGrid1->Row = Row;
}
Gambit
 

{smallsort}