qnx.display.Display

Display

Properties | Methods | Events


Packageqnx.display
Classpublic class Display
InheritanceDisplay Inheritance flash.events.EventDispatcher

The Display class provides the functionality that enables you to interact with and configure displays. This includes the internal display as well as any external display that is connected via the HDMI port.

Class information:
PlayBook Tablet OS Version:   1.0.6

See also

DisplayType
MirrorMode



Public Properties

 PropertyDefined By
  display : Display
[static] [read-only] Returns the singleton Display object.
Display

Public Methods

 MethodDefined By
  
Do not use this constructor.
Display
  
Returns the number of displays.
Display
  
getDisplayHeight(displayIndex:int):int
Returns the native height of the display (in pixels).
Display
  
getDisplayId(displayIndex:int):String
Returns the ID of the display.
Display
  
getDisplayOffset(displayIndex:int):int
Returns the offset that must be applied to a window's x coordinate in order for it to appear on the indicated display.
Display
  
getDisplayType(displayIndex:int):String
Returns the type of display.
Display
  
getDisplayWidth(displayIndex:int):int
Returns the native width of the display (in pixels).
Display
  
getMirrorMode(displayIndex:int):String
Returns the current mirror mode type in use by a given display.
Display
  
getMode(displayIndex:int):int
Gets the current display mode of a display.
Display
  
getModes(displayIndex:int):Vector.<DisplayMode>
Returns a Vector of modes that are supported by the display, given the index of the display.
Display
  
getRotation(displayIndex:int):int
Returns the rotation angle of a display.
Display
  
isAttached(displayIndex:int):Boolean
Returns true if the display is currently attached, given the index of the display.
Display
  
setMirrorMode(displayIndex:int, mode:String):void
Enables and disables mirror mode on the main display.
Display
  
setMode(displayIndex:int, modeIndex:int):void
Sets the current display mode of a display.
Display
  
setRotation(displayIndex:int, angle:int):void
Rotate a display.
Display

Events

 Event Summary Defined By
   Dispatched when a new display is attached to the system.Display
   Dispatched when a new display is removed from the system.Display
   Dispatched when the display mode of a display changes.Display

Property Detail

display


display:Display  [read-only]

Returns the singleton Display object.

The following example returns a Display instance and outputs information about the Display to the console:

         var myDisp:Display;
         
         myDisp = Display.display;
         trace(myDisp.getDisplayId(0));
         trace(myDisp.getDisplayHeight(0));
         trace(myDisp.getDisplayWidth(0));
         trace(myDisp.getDisplayType(0));
         


Implementation

public static function get display():Display

Constructor Detail

Display()


public function Display()

Do not use this constructor. Instead, use the static display() function.

See also

display()

Method Detail

getDisplayCount()


public function getDisplayCount():int

Returns the number of displays.

This number may be greater than the number of displays currently attached.

Returns

int — The number of displays.

getDisplayHeight()


public function getDisplayHeight(displayIndex:int):int

Returns the native height of the display (in pixels).

Parameters

displayIndex:int — The index of the display.

Returns

int — int

getDisplayId()


public function getDisplayId(displayIndex:int):String

Returns the ID of the display.

This allows you to distinguish between the different displays that are currently connected. In the following example, settings and a DisplayMode instance are applied to an external display given a unique ID.

             if (myDisp.getDisplayId(1) == "EXTERNAL1") {
                                    
                myMonMode = new DisplayMode();
                myMonMode.aspectRatio = "16:9";
                myMonMode.interlaced = true;
                myMonMode.refresh = 60;
                myMonMode.isPreferred = false;
                myMonMode.index = 6;                
                
                myDisp.setMode(1, 6);
                myDisp.setRotation(1, 0);
                myDisp.setMirrorMode(1, MirrorMode.STRETCH);
                    
            }
            else{
                myDisp.setRotation(0, 90);
                myDisp.setMirrorMode(0, MirrorMode.NORMAL);
            }
         

Parameters

displayIndex:int — The index of the display.

Returns

String — String

getDisplayOffset()


public function getDisplayOffset(displayIndex:int):int

Returns the offset that must be applied to a window's x coordinate in order for it to appear on the indicated display.

Parameters

displayIndex:int — The index of the display.

Returns

int

getDisplayType()


public function getDisplayType(displayIndex:int):String

Returns the type of display. Possible values are:

  • DisplayType.HDMI
  • DisplayType.INTERNAL

Parameters

displayIndex:int — The index of the display.

Returns

String

See also

DisplayType

getDisplayWidth()


public function getDisplayWidth(displayIndex:int):int

Returns the native width of the display (in pixels).

Parameters

displayIndex:int — The index of the display.

Returns

int — int

getMirrorMode()


public function getMirrorMode(displayIndex:int):String

Returns the current mirror mode type in use by a given display.

The mirror mode defines the resolution and appearance of the source on a secondary display.

Parameters

displayIndex:int — The index of the display for which to return the setting.

Returns

String — The current mirror mode setting. The constants for this are given by the MirrorMode class.

See also

MirrorMode

getMode()


public function getMode(displayIndex:int):int

Gets the current display mode of a display.

Parameters

displayIndex:int — The index of the display for which to get the mode.

Returns

int — The index of the mode that the display is set to.

getModes()


public function getModes(displayIndex:int):Vector.<DisplayMode>

Returns a Vector of modes that are supported by the display, given the index of the display. Each element is of type qnx.display.DisplayMode.

Parameters

displayIndex:int — The index of the display.

Returns

Vector.<DisplayMode> — A Vector of DisplayModes instances.

See also

DisplayMode

getRotation()


public function getRotation(displayIndex:int):int

Returns the rotation angle of a display.

Parameters

displayIndex:int — The index of the display for which to set the mode.

Returns

int — int

isAttached()


public function isAttached(displayIndex:int):Boolean

Returns true if the display is currently attached, given the index of the display.

The following example checks to see if an external display is attached.

                if (myDisp.isAttached(1)) {
                                    
                    myDisp.setRotation(1, 0);
                    myDisp.setMirrorMode(1, MirrorMode.STRETCH);
                    
                }
                else{
                    myDisp.setRotation(0, 90);
                    myDisp.setMirrorMode(0, MirrorMode.NORMAL);
                }
         

Parameters

displayIndex:int — The index of the display.

Returns

Boolean

setMirrorMode()


public function setMirrorMode(displayIndex:int, mode:String):void

Enables and disables mirror mode on the main display. Mirror mode allows you to mirror the main display on an secondary display.

Parameters

displayIndex:int — The index of the display on which to set mirror mode.
mode:String — The mirror mode setting to use. The constants for this are given by the MirrorMode class.

See also

MirrorMode

setMode()


public function setMode(displayIndex:int, modeIndex:int):void

Sets the current display mode of a display.

The following example creates a DisplayMode instance and applies it to a display.

         myMonMode = new DisplayMode();
         myMonMode.aspectRatio = "16:9";
         myMonMode.interlaced = true;
         myMonMode.refresh = 60;
         myMonMode.isPreferred = false;
         myMonMode.index = 6;
         
         myDisp.setMode(1, 6);
         

Parameters

displayIndex:int — The index of the display for which to set the mode.
modeIndex:int — The index of the mode for which to set the display.

See also

DisplayMode

setRotation()


public function setRotation(displayIndex:int, angle:int):void

Rotate a display.

Parameters

displayIndex:int — The index of the display on which to set the mode.
angle:int — The rotation angle in degrees. Can be one of 0, 90, 180 or 270.

Event Detail

displayAttached


Event Object Type: qnx.events.DisplayEvent
DisplayEvent.type property = qnx.events.DisplayEvent.DISPLAY_ATTACHED

Dispatched when a new display is attached to the system.

displayRemoved


Event Object Type: qnx.events.DisplayEvent
DisplayEvent.type property = qnx.events.DisplayEvent.DISPLAY_REMOVED

Dispatched when a new display is removed from the system.

modeChanged


Event Object Type: qnx.events.DisplayEvent
DisplayEvent.type property = qnx.events.DisplayEvent.MODE_CHANGED

Dispatched when the display mode of a display changes.