Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Build Error

Build Error

Build Error

At runtime I want to generate a pagecontrol with a number of tabsheets, each tab sheet to have a StringGrid.
My code for doing so is:
ppc = new TPageControl(this);
ppc->Parent = this;
ppc->Align = alClient;
ppc->TabPosition = tpTop;

{ TabArray[i] = new TTabSheet(this);
TabArray[i]->PageControl = ppc;
TabArray[i]->Name = AnsiString("TabArray") + IntToStr(i);
TabArray[i]->Caption = sTitles[i];
TabArray[i]->PageIndex = i;
TabArray[i]->OnShow = TabOnShow;

GridArray[i] = new TStringGrid(TabArray[i]);
GridArray[i]->Parent = TabArray[i];
GridArray[i]->Align = alClient;
GridArray[i]->ColCount = 8;
GridArray[i]->RowCount = 2;
GridArray[i]->DefaultRowHeight = 18;
GridArray[i]->FixedRows = 1;
GridArray[i]->FixedCols = 1;
GridArray[i]->Name = "sg" + IntToStr(i+1);
GridArray[i]->Width = 990;
My function for the "DoMouseUp" is as follows:
void __fastcall TfMainRecharges::DoMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)

// code to go here

However when I make or build I get following error:

[c++ Error] MainRecharges.cpp(113):'fastcall TControl::DoMouseUp(TWMMouse & TMouseButton)' is not accessible

I canm't seem to work out how to get around this, is there a fix?

RE: Build Error

I am assuming that 'fastcall TControl::DoMouseUp(TWMMouse & TMouseButton)' is meant to be a call to the ancestor DoMouseUp method from the TfMainRecharges::DoMouseUp method.DoMouseUp. The problem is that there is no such method declared in TControl. The call I think you are looking for would be MouseUp, not DoMouseUp. And the parameters do no match up either; TControl::MouseUp takes the same parameters as your TfMainRecharges::DoMouseUp. Your call to TControl::DoMouseUp only has the one parameter, a reference to TWMMouse called TMouseButton??? I am pretty sure this was not what you wanted.

RE: Build Error

I was trying to do the same as I did earlier. You will notice in defining the TabArray a line "TabArray[i]->OnShow = TabOnShow;"
which performs the OnShow event of the TabSheet. This works fine.

The function for this is as below:
void __fastcall TfMainRecharges::TabOnShow(TObject *Sender)
{ int i;

TTabSheet* tab_sender = dynamic_cast<TTabSheet*>(Sender);
if(tab_sender != NULL)
{ if(tab_sender == TabArray[i])
{ TabIndex = i;
bModified[TabIndex] = true;
bFileIsOpen[TabIndex] = true;

RE: Build Error

There is no Event or Method in TControl or any of it's descendants called DoMouseUp; There is an OnMouseUp event that you can assign an event handler to (which I think is what you may be actually trying to do), and a MouseUp Method that you can override.

Question: What is this line actually saying to the compiler?

GridArray[i]->DoMouseUp; //access TStringGrid::DoMouse

I think what you actually want is:

GridArray[i]->OnMouseUp = TfMainRecharges::DoMouseUp;

RE: Build Error

Many thanks.... "GridArray[i]->OnMouseUp = TfMainRecharges::DoMouseUp;" is what I needed, fixed the problem.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close