Responses in line... >Thanks for the reply Ken, > >Conceptually I think the container approach makes sense but it seems >there are several problems in implementing it. > 1. My testing seems to show that the size of the contents cannot exceed >the size of the container. If this is correct - the container will >overwrite the other controls on the form at design time.
The container can be set to have a border width of 0 and a backstyle of transparent. This will make it easier to see what underlies it at design time. You can also make it any size initially, and put it anywhere on the form, and in its own Init() method, set its size and position--and turn the border and background back on, if you want. > 2. I don't see a way to design the form with just the TextBox showing >at design time. You could add code to the Container's Init() method to add the EditBox. If your .vcx class library contains your subclassed EditBox, then all you need to do is: Container Init() * Assuming, as others have said, you've got a SET CLASSLIB referencing your .vcx class library somewhere up the call stack. THIS.AddObject('MyEditBox","MyEditBoxClass") WITH THIS.MyEditBox * Set size and position relative to the container .Top = ??? .Left = ??? * Alternatively, you can hard-code the size and position of your editbox subclass and omit the above items. * As long as you don't also do .Visible = .T., the user won't see it until the textbox calls it into existence. ENDWITH Remember, though, that controls' Init() methods are called from the "inside out"; Any controls inside your container class will Init() first, then the container Init() fires, and finally, the form's Init() fires. So don't put anything in your Init() methods that depends on a containing control's existence. You can even use the "pay as you" concept to wait to add the EditBox until the user does something that actually needs it. Just wrap it with a test so it only gets added once, like so: * In some method of the container IF TYPE("THIS.MyEditBox") <> "O") OR ISNULL(THIS.MyEditBox) THIS.AddObject(....) ENDIF > 3. I don't know how to tie the TextBox height and width to the >container height and width. You can look at the .Anchor property of controls; this property tells the control what to do when the control that contains it is resized. You set the Anchor property of the container to resize as you wish when the form resizes, and you set the Anchor properties of the contained objects so they will resize when the container resizes. I am not very familiar with the Anchor property; I've rolled my own resizing code because I started in VFP 6, before the propery existed. But this should do what you want. You may have to explicitly call the container's Resize() method at times, depending on what you want to do. Ken www.stic-cil.org _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/5.2.1.1.1.20090107110625.01afe...@pop3.frontiernet.net ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.