INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Forms & Screen

How to I make something Resize when the _SCREEN.Resize event fires? by wgcs
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

Resources

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