Great idea Malcolm, I am going to try that out!
Greg
-----Original Message----- From: profoxtech-bounces .at. leafe D.OT com [mailto:profoxtech-bounces@leafe.com] On Behalf Of Malcolm Greene Sent: Wednesday, June 30, 2004 6:50 AM To: profoxtech .at. leafe D.OT com Subject: RE: Pros and Cons of using _Screen vs. Top-Level Form for app
Greg (InnoMaster)!
Thanks for your follow-up! I'm sure there was a reason for my shift to top-level forms, but in my old age I totally forget why :)
As for the statusbar issue - here's a cool trick I've been using with good success. It allows you to convert any label (or textbox) into a VFP like statusbar!
Do the following in your toplevel form's init() method.
1. Add a property to your top level form called oStatusBar. Set the value of this property to an object reference of a label control you're using as your statusbar.
* sets statusbar ref to a label called lblMyStatusBar ThisForm.AddProperty( "oStatusBar", ThisForm.lblMyStatusBar )
2. Add a timer class to your top-level form that fires every 0.25 to 1.0 seconds. In the timer event set:
* this will copy value of VFP's _Screen statusbar to your statusbar if type( "_Screen.ActiveForm" ) == "O" _Screen.ActiveForm.oStatusBar.Caption = _VFP.StatusBar endif
3. In form destroy() make sure you clear out oStatusbar reference
ThisForm.oStatusBar = .Null.
4. All your _Screen's statusbar messages will pass through to your custom statusbar. This includes menubar message text, control .StatusBarText, and any text you explictly set via "set message to".
...
Some ideas:
1. Ideally this should all be consolidated into a single container class with statusbar label and timer that you drag and drop on a form. Its on my "todo" to do this.
2. I've been experimenting with using a readonly text box vs. a label to display status bar info. I make the textbox readonly, set its .TabStop = .F. (so users can't keyboard into it), hide its borders, and set its background color to its parent's background color, etc. The benefit of a textbox vs. label is that I can mouse click on this type of status bar and copy its contents to the clipboard. Pretty cool in a nerdy sort of way. If you do this remember to change .Caption to .Value in step 2 above.
Malcolm
----- Original message ----- From: "Greg Gum" <Profox@Avasoft.com> To: profoxtech .at. leafe D.OT com Date: Wed, 30 Jun 2004 05:43:45 -0500 Subject: RE: Pros and Cons of using _Screen vs. Top-Level Form for app
I used to use the _screen, but when testing the app, I would have to remove all the foxpro menu's, then restore it all when the app was done to restore the developmental environment. I wrote code to do all of that but found it easier to just use a TLF and then the two environments don't mess with each other. However, I do like the statusbar of the screen. I wish there was a way to put it in a top level form.
Greg
-----Original Message----- From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces .at. leafe D.OT com] On Behalf Of Malcolm Greene Sent: Tuesday, June 29, 2004 10:55 AM To: profoxtech@leafe.com Subject: Pros and Cons of using _Screen vs. Top-Level Form for app
I'm taking a fresh look at my code and am starting to wonder why I used a Top-Level form as the main form for all my recent apps vs. using a regular form (maximized) in the _Screen. In retrospect, the _Screen approach seems less complicated for custom menus, custom toolbars, and statusbar messages.
Can anyone refresh my memory on the pros and cons of _Screen vs. Top-Level forms?
Thanks! Malcolm
[excessive quoting removed by server]
©2004 Greg Gum |