Board index » cppbuilder » Property with parameter

Property with parameter


2004-08-20 04:56:54 PM
cppbuilder59
Hi, good day!
I declared a property with index in my control
__property AnsiString Cells[int][int] = {read = GetCells,
write = SetCells};
but it always causes an access violation.
Usually, my read access specifier is a variable, for example,
read = FCells. I can initialize this in the constructor.
But with a function read access specifier, there are times that
the program executes that function even if there is no one
calling it (or none, I think so). Here is some lines of the code:
class TEditListView : public TListView
{
private:
AnsiString __fastcall GetCells(int ARow,int ACol);
void __fastcall SetCells(int ARow,int ACol, AnsiString AStr);
__published :
__property AnsiString Cells[int][int] = {read = GetCells,
write = SetCells};
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_LBUTTONDOWN, TMessage, WMLButtonDown)
VCL_MESSAGE_HANDLER(LVM_INSERTCOLUMN, TMessage,
LVMInsertColumn)
END_MESSAGE_MAP(TListView);
};
When I debug it, the value of ARow and ACol is both 1242780.
Is there a special procedure for function read-access specifiers
or is it caused by some other forces =) that I can't see?
Thanks!
 
 

Re:Property with parameter

"Jet" < XXXX@XXXXX.COM >wrote in message news:4125bcd6$ XXXX@XXXXX.COM ...
Quote
__published :
__property AnsiString Cells[int][int] = {read = GetCells, write = SetCells};
Properties defined in a __published section cannot be array properties.
Move it to public and it will work fine.
Object Inspector reads published properties of a component
whenever the component is selected and even when it needs to
repaint its window.
Todd
 

Re:Property with parameter

"Todd Brylski" < XXXX@XXXXX.COM >wrote:
Quote
Properties defined in a __published section cannot be array properties.
Move it to public and it will work fine.
Thanks Todd! =)
 

{smallsort}