Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Frame object
Message
From
20/02/1997 15:08:57
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00021110
Message ID:
00021409
Views:
30
>In VB, there's a frame object that I've come to enjoy. But VFP doesn't have this control. I've been thinking about making a custome control, but I'm not sure what I should base it on. Plus, since the frame object in VB is esentially two objects in one (the box and the label), I don't really think it's possible in VFP. But, I'd love it if someone said it was possible! For all I know someone might have already came up with this!
>
>It's just too tedious to create a makeshift box 'n label every time the way I like them.
>
>Thanks!

Sure no problem.

Use a Visual FoxPro CONTAINER and create your own subclass of it to make your frame class.

1) Set the container borderwidth to 0 (none) and for good measure set tis style to PLAIN not 3D.

2) Add a SHAPE object inside the container, make it the same width and the height less say 7 pixels smaller than the height of the container and make its top 6 pixels below the top.

3) Make sure you use the SEND TO BACK button to put it at the back of the Z-order to buttons etc appear on top of it!

4) You might want to disable it's acceptance of tabbing to it and setting focus, by setting TabStop to .F. (I can't remember if this is necessary).

5) Add a LABEL to the container, positioning it in the top left.

6) Make the label OPAQUE back style, not transparent.

7) Make the label pick up the form's colour settings.

8) Oh, I forgot - make the shape transparent, and 3D.

9) Add a NEW PROPERTY to the container, pcCaption

10) IN the INIT() of the container, set the caption of the Label (added at atep 5) to be " " (one space) plus the value of pcCaption plus " "

Save the class - perhaps call it "Frame" in your class library.

Now you have a class that does what you want and has added benefits!
Because it's a VFP class you can subclass it and add new methods and properties for special purposes.

I think there is already a class that does all this in the files sectiton here, or on the Compuserve VFOX forum. I know I downloaded one (but didn't unzip it) in the last week...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform