>I like the way HTML automatically "reflows" when a browser window is resized. Is there any way to duplicate this behavior in a VFP form?
>
>I've tried playing with the control's Anchor property (relative vs absolute) but cannot make them "reflow" like in a browser.
>
>Does anyone know if this can be done with pure VFP code/controls? I know that I can use the webbrowser control in a VFP form and have it render HTML but this technique is causing some problems in itself (like input text reverting to wrong values on refreshing). I'd like to have this done in 100% VFP.
>
>TIA
>
>Mike
Hi Mike,
I don't know whether this is a good solution or not. But I hope it give you the clue to get started.
Try this. The class will re-position the top coordinate.
1. create a custom class base on Label
2. set it's properties:
Anchor = 10
WordWrap = .T.
AutoSize = .T.
3. add property:
nOldHeight = 0
4. add ACCESS method to Anchor property
5. Put this code:
This.nOldHeight = This.Height
Local lo_Control, ln_SizeX, ln_X
With This
If (.nOldHeight != .Height)
ln_SizeX = .Height - .nOldHeight
.nOldHeight = .Height
ThisForm.LockScreen = .T.
For each lo_Control in .Parent.Controls
If (lo_Control.Name != .Name) and (lo_Control.Top > .Top)
lo_Control.Top = lo_Control.Top + ln_SizeX
endif
EndFor
lo_Control = Null
ThisForm.LockScreen = .F.
endif
EndWith
Return This.Anchor
Drop that object to the form. Change the caption and the width to your like.
Good luck!
Herman