Fires when a change occurs to the display settings either via modifying the operating systems display settings or by rotating the screen on a device.

 

Parameters

<nImageDepth>

Number of bits per pixel

<nScreenWidth>

Screen Width in pixels

<nScreenHeight>

Screen Height in pixels

 

Property of

FrameWindow, Form, SubForm

 

Description

OnDisplayChange will fire when a user applies changes to Window's Display Settings after modifying the color depth or the screen resolution or when rotating a device such as a Windows tablet and screen rotation is allowed. The parameters contain the new settings for the display.

An application can check if nScreenWidth is greater than nScreenHeight or not to determine if rotation has occurred and resize or reposition its frame window, forms, or form components to adjust for the change.

If an event handler is assigned to _app.frameWin.onDisplayChange either in the dBASE IDE or in a dBASE application, OnDisplayChange() will fire when one of the above changes occur. Any open forms or subforms with their own OnDisplayChange event handlers will also fire.

In a non-mdi application, with the frame window hidden, the top level form's OnDisplayChange() event handler will fire first followed by any OnDisplayChange() event handlers assigned to children forms or subforms.

If no event handler is assigned to _app.frameWin.onDisplayChange, dBASE will run its default handler which checks if the current frame window's height extends past the bottom of the screen or the width extends past the right edge of the screen. If either case is detected, the frame window's height or width is reduced to fit the new screen dimensions.

Example:

// Given an function to use as an event handler in a source file: frameutil.prg

function frameOnDisplayChange( nImageDepth, nScreenWidth, nScreenHeight )

   if nScreenWidth > nScreenHeight

      // landscape

      // re-arrange application forms for landscape mode

   else if nScreenWidth < nScreenHeight

      // portrait

      // re-arrange application forms for portrait mode

   endif

   return

// In application's initialization code, include:

set procedure to frameutil.prg

_app.framewin.ondisplaychange := frameOnDisplayChange

// Using _app.frameWin