I created a custom control in a “ContainerControl”
the base control is set to 100px wide (so when it is dragged to the Window that is the size it shows initially)
Then at design time I adjust the width to be 450px…
However when I run the app, in the Open Event of the control placed on the window, it still says it is 100px wide
here is what is REALLY strange
W=self.width // reports 100 px [me.width gives same answer]
but if I put a breakpoint there and examine the control… is says it is 450px wide
it is the container that I need the width of…
It contains one template control
as a test I set the template control to be 98px wide… and THAT is what Self if returning. even though the IDE tells me that Self is actually the container
that code is in a Method of the CONTAINER… when I put the mouse over SELF, it says Self=Container, yet it is returning the Width of CONTROL1(0) not CONTAINER1
The method is used to add new members to to CONTROL1 controlset … and W is to set the width of each control
It all works perfectly , except it is using the wrong width value to calculate from
I figured it out… stupid me…
The container control also had a METHOD called WIDTH… which returns the width of the default control
I only noticed, when I let Autocomplete show me the properties. width was lowercase, where the real width is “Width”
So I can rename the method to solve the issue… but why didn’t the compiler complain?[/quote]
Because it’s not an error to do so - sometimes you want to be able to shadow a property by doing exactly this. However, analyze project would probably have given you a warning about this.