inheritance problem

Posted by gdb390 on 03-Feb-2011 09:07

Hello,

I have a form called baseTest.cls which has a ultragroupbox (viewstyle=office2007 // dock = fill) and one button. (very simple )

I can create a new form (finalTest.cls) that inherits from the baseTest.cls .

If I want to add another widget, e.g. Ultrabutton I can not, because the ultragroupbox of the baseform is locked.

is there a way to achieve this, so that I can use the baseform and add widgets specific for a customer in the inherited form

kind regards

gerd

All Replies

Posted by Admin on 03-Feb-2011 09:16

If I want to add another widget, e.g. Ultrabutton I can not, because the ultragroupbox of the baseform is locked.

 

Did you try to make the ultragroupbox protected in the base form?

Posted by gdb390 on 03-Feb-2011 09:52

Mike, your suggestion was the right one !

but I still find it strange ... I thought that public / protected / private had to do  with the ability for accesing the data members ...

I  could never imagine that it also has an influence in order of displaying widgets !

cheers

Gerd

Posted by Admin on 03-Feb-2011 10:01

Well, in order to add another Control to

ultraGroupBox1:Controls:Add (newButton1).

the ultraGroupBox1 needs to be accessible, and so protected or public ( ). Just check the InitializeComponent method of the inherited Form.

Mike

Posted by gdb390 on 03-Feb-2011 10:18

I hoped that every form would have his own canvas ... not !

Posted by Admin on 03-Feb-2011 10:41

I hoped that every form would have his own canvas ... not !

Using inheritance the base form and the inherited form become one. There are no two forms.

Even if you make some controls protected, the (one and only) Controls collection (of the whole) is always public. So ultimately there is no real encapsulation of controls from any level at all......

This thread is closed