Thanks Ken and everyone who has contributed to my progress!  I now 
understand how to create and edit my own classes as well as how to review 
the ones in the Samples structure.

I have come up with an approach that appears to do what I want using info 
from this post.

I use a container base class and put a  tiny TextBox inside it along with 
an EditBox.
In the TextBox.Init I set Top, Height, Left, and Width to match the 
Container bounds.
In the Container.Init I set Top, Height, Left,  and Width to match the 
Form bounds.
This lets me size and place the container wherever I want at design time 
and at run time the TextBox shows up in exactly the same space.  Resizing 
the container insures that my control can grow without colliding with the 
edge of the container.  That brings me to the next question which is 
another post.

Thanks so much! - Joe

On Wednesday, January 07, 2009 11:37 AM, Ken Dibble wrote:
>
>Date: Wed, 07 Jan 2009 11:37:17 -0500
>From: Ken Dibble
>To: [email protected]
>cc:
>Subject: Re: Rethinking: accessing the properties of a parent (newbee)
>
>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
>
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
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/[email protected]
** 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.

Reply via email to