BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

StringGrid

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
LMario
Guest





PostPosted: Sat May 06, 2006 4:14 am    Post subject: StringGrid Reply with 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?
Back to top
Michel Leunen
Guest





PostPosted: Sat May 06, 2006 12:14 pm    Post subject: Re: StringGrid Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.