properties - Why is happened property write error? -
c++ : run time error happened error message this.
"revstrings1-> height of reading included in error: property write-protected."
("revstrings1->height の読み込中のエラー : プロパティは書き込み禁止です.")
i'm using c++ builder 3.
this source code can compiled setting library, include path , etc.
but run time error happened.
i guess problem property read & write.
how can simplly fix problem ?
a variable 'revstrings1' created class 'trevstrings'.
//--------------------------------------------------------------------------- #ifndef revstringsh #define revstringsh //--------------------------------------------------------------------------- #include #include #include #include #include //--------------------------------------------------------------------------- class package trevstrings : public tstringgrid { private: // void __fastcall setwidth(int w); // int __fastcall getwidth(void); // int fcolcount ; int frowcount; int ffixedcols ; int ffixedrows ; int fdefaultcolwidth ; int fdefaultrowheight ; int fheight; // int fwidth; int fscrollbars; int fmaxlength; bool colcolors[24]; protected: public: __fastcall trevstrings(tcomponent* owner); void __fastcall drawcelltext(trect arect,int aleft,string s); virtual void __fastcall drawcell(int acol, int arow, const windows::trect &arect, tgriddrawstate astate); void __fastcall setcolor_col(int col,int row); void __fastcall setcolorflag(int col,bool flag); bool __fastcall getcolorflag(int col); void __fastcall setedittext(int acol, int arow, const system::ansistring value); void __fastcall clear(bool allorone,int position); void __fastcall dblclick(void); __published: // __property int colcount = {read = fcolcount};//fcolcount}; __property int rowcount = {read=frowcount}; __property int fixedcols = {read=ffixedcols}; __property int fixedrows = {read=ffixedrows}; __property int defaultcolwidth = {read=fdefaultcolwidth}; __property int defaultrowheight = {read=fdefaultrowheight}; __property int height = {read=fheight}; // __property int width = {read=getwidth,write=setwidth}; __property int scrollbars = {read=fscrollbars}; __property int maxlength = {read=fmaxlength,write=fmaxlength}; /* */ }; //--------------------------------------------------------------------------- #endif
never heard of trevstrings
before
- so either bcb 3 discontinued stuff (my bds2006 not have @ disposal)
- or have 3th party custom package installed
- but header file suggest based on string grid
- so if below text not work if can switch
tstringgrid
instead
in tstringgrid
size properties accessible normaly:
stringgrid1->height=256; stringgrid1->width=128;
if want have size-able col/rows not forget open options property
- and set
gorowsizing,gocolsizing
true
- and starting sizes
defaultcolwidth,defaultrowheight
here example of ussage
// resize grid stringgrid1->height=128; stringgrid1->width=256; // access cell ansistings stringgrid1->cells[0][0]="(0,0)"; stringgrid1->cells[1][1]="(1,1)"; stringgrid1->cells[1][2]="(1,2)"; stringgrid1->cells[2][1]="(2,1)"; // resizing row/col stringgrid1->rowheights[0]=15; stringgrid1->rowheights[1]=20; stringgrid1->colwidths[0]=20; stringgrid1->colwidths[1]=15;
as class derived should work if not there more possibilities:
you have unrelated bug somewhere
- overwriting should not
- damaging c++ engine app running on
- or have memory leak somewhere
- or memory manager invalidated see bds 2006 c hidden memory manager conflicts not case
- or calling vcl/winapi visual stuff threads
- to check this:
- create empty application, add trevstring , try set height on runtime
- if no error occurs have bug somewhere if error occurs then:
this component not able resize on runtime way
- try use functions
setsize,setbounds
instead - or place component on panel align client , resize panel
- try use functions
if not swith standard
tstringgrid
- you can try cast
revstring
stringgrid
first ((tstringgrid*)(revstring1))->height=25;
- you can try cast
borland compilers weird
- few times (around 10) on years use bcb/bds
- the compiler compile wrongly
- the app running code gets distorted or discarted
- what helps?
- close ide or restart windows
- delete map,obj,tds temp files prior compiling rebuilding
- sometimes needed add empty line of code or swap 2 lines of code
identifiers/names collisions
- if name stuff in similar way vcl functions ask problems
- usual error name function
draw()
... (usedraw()
instead , fine)
for big projects
- if add source code new unit project instead of include (it present in object manager)
- then in big projects got big problems
- it looks units compiled differently normal included files
- in units expected formulars , othe vcl stuff components
- if got own non visual classes units stop working expected
- creating weird behavior (even error caused it)
- i observe on bcb5 , bds2006
- in bcb3,bcb4 did not make big projects
- and bcb6 buggy unusable big projects anyway
- by big projects mean > 1 mb of pure c++ code
Comments
Post a Comment