 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
LMario Guest
|
Posted: Sat May 06, 2006 4:14 am Post subject: StringGrid |
|
|
On a StringGrid, when I select a cell -with the keyboard or the mouse- a
OnSelectCell Event is generated. How can I know (inside the OnSelectCell
method) if the cell was selected with the mouse or the keyboard? |
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Sat May 06, 2006 12:14 pm Post subject: Re: StringGrid |
|
|
LMario wrote:
| Quote: | On a StringGrid, when I select a cell -with the keyboard or the mouse- a
OnSelectCell Event is generated. How can I know (inside the OnSelectCell
method) if the cell was selected with the mouse or the keyboard?
|
Check if the mouse is in the cell when the event is fired. It's not
reliable (you can place the mouse above a cell without clicking and then
select the cell with the keyboard) but it's a start:
void __fastcall TForm1::StringGrid1SelectCell(TObject *Sender, int ACol,
int ARow, bool &CanSelect)
{
POINT p;
GetCursorPos(&p);
p = StringGrid1->ScreenToClient(p);
int col,row;
StringGrid1->MouseToCell(p.x,p.y,col,row);
if((col == ACol) && (row == ARow))
{
// the mouse is in the cell
}
else
{
// cell selected with the keyboard
}
}
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|