Bug? CustomView; designer set propertie takes priority over code set propertie?

Cableguy

Expert
Licensed User
Longtime User
Hi EREL

Still having trouble with a few things that should be a lot more straight forward by now...

I am placing my CustomView in the Designer, so that all the initializing takes place within, and I only use the DesignerCreateView sub to place the additional views that will be composing the final CustomView. All is OK that far.
What I get as a BUG is that, I define the CustomView Width in the designer to be (i.e) 250 and then, after setting a public sub to expose the Width I set it to be 200 in code, just to try things out.
In the CustomView Resize event I placed a log to see what was going on, and to my surprise, the log shows FIRST the resizing to 200, and AFTER sets the 250 as final width...
This is not what I would expect!
 

stevel05

Expert
Licensed User
Longtime User
I think this is because the layout pass hasn't completed when you set the size. If you use Sleep before setting or CallsubDelayed to set the width it will work as expected.
 

Cableguy

Expert
Licensed User
Longtime User
I'm getting rusted...
I tried the "harder" way, setting a loop while the CustomView was not initialized, and only after set the width but that didn't work either...
Sleep(0) works great!
 
Top