Welcome to Foxite.COM Community Weblog Sign in | Join | Help

Bernard Bout

May the Fox be with you...

<May 2006>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Post Categories

News

site statistics

Locations of visitors to this page

Navigation

Some VFP links

Others...

Archives

Who links to this site?

Hey There!!!

Syndication




The Scrollable Viewport Part III - Malcolm keeps me on my toes

After solving the problem of the funky behaviour of the scroll bar in this post I was ready for new pastures. But my pal Malcolm would not let up.

How is your scrollbar class handling the following challenges:

1. Parent form Deactivate/Active events fired when scrollable container (window and/or window scrollbars) get focus.

2. Having your scrollable container have a working .Anchor property so it can automatically shift and resize as its parent form is resized.

he fired back at me.

Well a form does NOT have an anchor property but that should not stop us.

Although I have not exactly done as requested, I have a solution. Remember the invisible ScrollViewport placeholder? It's still on the form and is still an object that VFP can see, although you can't because it's VISIBLE = .F.

So open the parent form and set the Anchor property of the placeholder to (you have upgraded to VFP9 I hope) :

Anchor = 15

One more thing to do. Bind the child form to the anchors of the viewport. To do this we need a reference. Create a custom property of the parent form called oChild. Add the following line after the original code in the INIT so that it looks now:

DO FORM scroller NOSHOW

SHOW WUNDOW scroller IN WINDOW scrollparent

With Scroller

   .Top = ThisForm.Placeholder.Top

   .Left = ThisForm.Placeholder.Left

   .Height = ThisForm.Placeholder.Height

   .Width = ThisForm.Placeholder.Width

ENDWITH

ThisForm.oChild = scroller

Finally in the RESIZE of the parent form add this smidgen of code:

WITH ThisForm.oChild

   .Top = ThisForm.Placeholder.Top

   .Left = ThisForm.Placeholder.Left

   .Height = ThisForm.Placeholder.Height

   .Width = ThisForm.Placeholder.Width

ENDWITH

And that's that for the Anchor where the Anchor = 15

Next task is to get this code in the Scroll Class iteslf. This should be trivial. Just move the above code from the resize event of the parent into a custom method of the child and add code to BIND EVENTS () of the Parent Resize to the custom resize of the child, based on a property. Also this is for an anchor of 15 so if you wanted to handle all the other Anchor settings then a case statement is the go.

#1 I still haven't solved (yet) but it should only be a matter of time.

Bring it on Mal.

 

Later...

Published Tuesday, May 23, 2006 10:20 AM by bbout

Comments

No Comments

New Comments to this post are disabled
Powered by Community Server, by Telligent Systems