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 

Using TMenuItem

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





PostPosted: Thu Jun 24, 2004 2:54 pm    Post subject: Using TMenuItem Reply with quote




Hi there

I have a pop-up menu that is linked to various TDBGrids, with
one TMenuItem for saving the grid to a text file.

My problem is that for the life of me I cannot figure out how to
access the actual grid that called the function since in the
event handler the "Sender" is the TMenuItem itself.

How do I get the grid from which the call originated???


/**
* This function gets called whenever the user clicks on
* the "Save to Text" menu item for grids.
*/
void __fastcall TNetAnSaveGridToFileDialogForm::SavetoTextMenuItemClick(
TObject *Sender) {
//here sender is the "TMenuItem" and not the "TDBGrid" from
//which the call orignated...
}

Any help appreciated!!!

Regards,
Francois
Back to top
Antonio Felix
Guest





PostPosted: Thu Jun 24, 2004 5:06 pm    Post subject: Re: Using TMenuItem Reply with quote




"Francois" <francois.lombard (AT) siemens (DOT) co.za> wrote:
Quote:

Hi there

I have a pop-up menu that is linked to various TDBGrids, with
one TMenuItem for saving the grid to a text file.

My problem is that for the life of me I cannot figure out how to
access the actual grid that called the function since in the
event handler the "Sender" is the TMenuItem itself.

How do I get the grid from which the call originated???


/**
* This function gets called whenever the user clicks on
* the "Save to Text" menu item for grids.
*/
void __fastcall TNetAnSaveGridToFileDialogForm::SavetoTextMenuItemClick(
TObject *Sender) {
//here sender is the "TMenuItem" and not the "TDBGrid" from
//which the call orignated...
}

Any help appreciated!!!

Regards,
Francois


Hi,

Dinamically assign the TMenuItem->Tag property with a value
related to the calling grid. Then in the Click Handler check
the Sender Tag in order to know the caller grid.

HTH
Antonio


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.