Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controlling resize and anchoring
Message
 
To
19/01/2007 09:05:58
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01185929
Message ID:
01187010
Views:
21
>>>Yeah, that makes sense, but doesn't seem to buy anything over simply writing the programmatic resize code as:
>>>
>>>
>>>LOCAL nAnchor
>>>
>>>nAnchor = Whatever.Anchor
>>>Whatever.Anchor = 0
>>>
>>>* do the resize/reposition
>>>
>>>Whatever.Anchor = m.nAnchor
>>>
>>>
>>>What I was looking for was a way to not have to remember to do something (whatever it is) on a programmatic resize/reposition.
>>>
>>
>>Yeah, but then why use anchors, if they're going to be 0 during the resize? My suggestion was based on the assumption that you'd raise an event like BeforeProgramaticResize which the objects would react to, by deAnchoring themselves.
>>Or, maybe I misunderstood it. I was assuming that you'd want to deAnchor the objects before the programatic resize and reanchor them after so they would behave properly to the interactive. Are these objects supposed to react to the progr resize or is only their form/container affected by the programatic resize?
>
>I've obviously done a poor job of explaining the problem everywhere I've posted. Here's the deal. I'm modeling a physical object, which the user can construct interactively.
>
>When the form is created, I programmatically resize it and add and position a number of objects.
>
>Once the form is displayed, the user can:
>1) add objects, which must be programmatically positioned correctly;
>2) move objects around, which must be properly repositioned programmatically;
>3) resize the form, in which case everything must be resized and repositioned.
>
>The anchors handle #3, but get in the way of #1 and #2.
>
>IAC, I've added code like that I showed above and it's all working. I just hoped to make it more transparent.
>

It makes sense. Thanks for the explanation. I guess I was missing 2).
My suggestion was along the lines of encapsulating the Anchor (re)setting in the objects' class, so you won't have to remember to do it for every object. A form method with something like:
Raise event beforeProgResize (or SetAll("useAnchors", .F.))
Do the objects resize / reposition - no worries about anchors
Raise event afterProgResize (or SetAll("useAnchors", .T.))
*
Anyway, sounds like a very interesting project. Good luck!

Sorin
Previous
Reply
Map
View

Click here to load this message in the networking platform