Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inherited private property to public (InplaceEditor)

Status
Not open for further replies.

gillz67

Programmer
Mar 31, 2005
3
0
0
GB
Please, Can anyone help me with this syntax problem!
I have a StringGrid with the main data centred, plus I overwrite the bottom of the cell with info in grey. Problem is, when I edit the cell the data goes left and my grey info gets wiped out, so I need to reposition and resize the InplaceEditor within the cell.
It must be possible as I've found Delphi examples of similar stuff but can't get it to work in bcb. The following is my class definition and simply a button to try and access the left & width properties, but it gives me an access violation error:-

class TMyGrid : public TStringGrid
{
public:
__fastcall TMyGrid(
TComponent* AOwner) :
TStringGrid(AOwner) {}
__property InplaceEditor;
};
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int EdWidth = TMyGrid(StringGrid1).InplaceEditor->Width;
int EdLeft = TMyGrid(StringGrid1).InplaceEditor->Left;
String s = "Width=" + IntToStr(EdWidth) + " Left=" + IntToStr(EdLeft);
}

What am I doing wrong???

 
I think the inplace editor is not a public member
of the stringrid component. You might try subclassing
the stringrid and or the inplace editor to access it.

TC
 
Thanks for your replies.
Today I tried the Borland newsgroups and got the answer I required ie
int EdWidth = ((TMyGrid*)StringGrid1)->InplaceEditor->Width;
is the correct syntax for casting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top