Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Undocumented _SCREEN Stuff
Message
 
 
À
09/02/2004 10:27:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00875468
Message ID:
00875482
Vues:
24
Ken,

The PAINT() is event (not method) and documented as such in the _SCREEN System Variable Properties, Methods and Events help.

>Dear All,
>
>We have found something in VFP that we believe to be undocumented and thought we would share it with all of you.
>
>The Environment
>
>We have a window that instantiates and remains loaded throughout the session cycle of our product. The window is designed to fill the right side of the _SCREEN from top to bottom and be 200 pixels wide. This needs to remain true even if the user resizes the window.
>
>VFP 8 is wonderful in that it allows us to use BINDEVENT to link the _SCREEN.Resize with the window Resize (we use a custom method for this called pm_screen_resize). Previously, we had to use a bit of custom code "magic" to get this to happen, but the advent of event binding has simplified this greatly. However, this is not the problem we encountered. I will continue.
>
>The Problem
>
>We recently added a new toolbar to the product and then noticed a very odd behavior: When the toolbar was undocked or docked to another location in _SCREEN, we saw that our persistent window (Task Pane) was not being resized in every instance. To be more specific, it was only being resized during a "Dock" and not during an "Undock". So, we went looking for why.
>
>Potential Solutions
>
>We tried placing code in the Dock and Undock methods, the resize methods and so forth in an attempt to understand the call stack cycles. What we discovered was that the source of the problem was to be found in the Undock. Code in the Undock that we placed to temporarily call the Resize was being called too early. We knew this because the toolbar was only being drawn AFTER the Undock had completed. What this resulted in was that the Resize call (by either BINDEVENT or by temporary direct-call) happened first and then the toolbar was redrawn. When the toolbar was redrawn, the _SCREEN would redraw itself without issuing another Resize event.
>
>No call to Resize anywhere would work. Dock, Undock, and so forth were all too early in the cycle. We were left scratching our heads and bewildered by it.
>
>The Solution - Undocumented
>
>On a hunch, we went looking in the VFP 8 help system at the properties and methods for the _SCREEN object. There we noted the Draw method and explored it, thinking that we could somehow "hook" that method to get behind the Undock. It did not work, but there was a note there that made some sense -- it referred to the Paint method.
>
>The Paint method is NOT in the list of method for the _SCREEN object. There is documentation for the Draw method, but not Paint. Nevertheless, we decided to try it.
>
>Eureka!
>
>The Paint method solved the issue. It got behind the Undock and in a BINDEVENT allowed the Resize code to be called well behind the re-painting of the toolbar, which in turn allowed us to properly size our Task Pane window with the new toolbar location dynamics.
>
>We are still somewhat unsure of just where in the cycle the Paint method is, but we do know that it falls after Undock on toolbar objects. The bottom line is that the connection between Paint and _SCREEN is undocumented (or perhaps incorrectly documented) and you can now know that you can call this method when you need to perform Resize event code when everything is done on your screen.
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform