Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tip of the day. Scrollable containers, the easy way
Message
From
30/04/2012 12:44:51
 
 
To
28/04/2012 14:29:17
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01542846
Message ID:
01542896
Views:
165
>Hi All,
>
>I'm not sure whether someone else has ever come up with this before...
>
>Its not neccesary to complicate things to get a scrollable container. You can design the scrollable container as a normal form with scrollbars and put that on another form.
>
>
>PUBLIC x
>x = CREATEOBJECT("Mainform")
>x.Show()
>
>*-
>
>DEFINE CLASS MainForm as Form
>	SContainer = NULL 
>	width = 700
>	Height = 400
>	
>	ADD OBJECT Pgf AS PageFrame WITH left = 5, Top =210, Width = 690, Height = 180, pagecount = 2, TabStyle = 1, Anchor = 14 
>
>	FUNCTION Init
>		THIS.sContainer = CREATEOBJECT("SContainer")
>		ACTIVATE WINDOW (THIS.sContainer.Name) IN WINDOW (THIS.Name)
>		THIS.sContainer.Show()
>		THIS.Resize()
>	ENDFUNC
>
>	FUNCTION resize
>		THIS.sContainer.Move(0,0, THIS.Width - SYSMETRIC(5), THIS.Height - 200 - SYSMETRIC(6))
>	ENDFUNC
>ENDDEFINE
>
>*-
>
>DEFINE CLASS Scontainer as Form
>	Scrollbars = 3
>	TitleBar= 0
>	BorderStyle = 0
>		
>	ADD OBJECT Explanation as Label WITH Caption = "This is the scrollable container", left = 100, top = 100, autosize = .t.
>	ADD OBJECT FarObject as commandbutton WITH Left = 1000, top = 1000
>ENDDEFINE
>
With this solution,
because the SContainer isn't a main form's member,
there are many side effects to fix with other code or bindevent().

Like:

1. if the main form datasession is changed, the Scontainer still on the original datasession.
2. when the focus go into a SContainer's member, the main form loses the focus
3. SContainer.parent doesn't exists
...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform