Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thanks for a great forum. My problem was answered just by scrolling through previously solved problems. Great service!!..."

Geography

Where in the world do Tek-Tips members come from?

Microsoft: Visual FoxPro FAQ

Forms & Screen

How to I make something Resize when the _SCREEN.Resize event fires?
Posted: 12 Nov 02 (Edited 10 Oct 03)

This has been tackled in a number of ways... the most common being creating a timer on the child form that repeatedly checks to see if _SCREEN.Height and _SCREEN.Width have changed.  

VFP8's BINDEVENT() probably is going to be the "Documented" way of doing this.
Update: VFP8 SP1 Deliberately disables the method of hooking the _SCREEN events described here due to instability of VFP when using this method.

However, still, the most elegant and simplest method I've seen is best demonstrated with code:

*Credit for this method must be given to the following:
*Fred Taylor - ElZorro 4/10/2001 www.elzorro.org
*with thanks to "Michel Roy" roym@jonar.com from the
*News Group microsoft.public.fox.programmer.exchange
*
* In your main program:
_Screen.AddObject("oResizer", "Resizer")

DEFINE CLASS Resizer AS Custom
  oScreen = _Screen
  KeyPreview = .t.

  PROCEDURE oScreen.Resize
    WAIT window "Resizing" NOWAIT
  ENDPROC

  FUNCTION oScr.Click && Works
    WAIT WINDOW NOWAIT "_SCREEN.Click"
  ENDFUNC

  FUNCTION oScr.DblClick && Works
    * Note that Click fires first!
    WAIT WINDOW NOWAIT "_SCREEN.DblClick"
  ENDFUNC

  PROCEDURE oScr.KeyPress && Works
  LPARAMETERS nKeyCode, nShiftStat, nKeyCode, nShiftStat
  ENDPROC

  PROCEDURE oScr.QueryUnload
    NODEFAULT && Hmmm, doesn't work like a form's does.
    WAIT WINDOW NOWAIT "QueryUnload!"
  ENDPROC

  PROCEDURE oScr.RightClick && Works
    DO testmenu.mpr
  ENDPROC

  *-------------------------------
  PROCEDURE oScr.MyMethod && Works
    * This fires on _SCREEN.MyMethod() !!
    wait window "my method fired!"
  ENDPROC

ENDDEFINE


See also: http://fox.wikis.com/wc.dll?Wiki~ScreenMethods
and http://fox.wikis.com/wc.dll?Wiki~ScreenResize

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close