 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jet Guest
|
Posted: Fri Aug 20, 2004 8:56 am Post subject: Property with parameter |
|
|
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!
|
|
| Back to top |
|
 |
Todd Brylski Guest
|
Posted: Fri Aug 20, 2004 11:18 am Post subject: Re: Property with parameter |
|
|
"Jet" <jettosan (AT) yahoo (DOT) com> wrote
| 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
|
|
| Back to top |
|
 |
Jet Guest
|
Posted: Mon Aug 23, 2004 1:24 am Post subject: Re: Property with parameter |
|
|
"Todd Brylski" <tbrylski (AT) yyaahhoooo (DOT) com> wrote:
| Quote: | Properties defined in a __published section cannot be array properties.
Move it to public and it will work fine.
|
Thanks Todd! =)
|
|
| Back to top |
|
 |
|
|
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
|
|