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 

Property with parameter

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





PostPosted: Fri Aug 20, 2004 8:56 am    Post subject: Property with parameter Reply with quote




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





PostPosted: Fri Aug 20, 2004 11:18 am    Post subject: Re: Property with parameter Reply with quote



"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





PostPosted: Mon Aug 23, 2004 1:24 am    Post subject: Re: Property with parameter Reply with quote




"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) 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.