GetMathErrValStr Include

GetViewportSize


The GetViewportSize function returns the width and height of the interior of the main Mira window.

Syntax

w, h = GetViewportSize()

bullet.gif    w and h are the width and height of the Mira window, measured in screen pixels.

Example

The script below shows how to create a text output window having a specified width and height. The CreateTextWindowfunction accepts relative dimensions rather than absolute ones. For example, it takes a Window rectangle like (0.1, 0.7, 0.1, 0.6) relative to the size of the main Mira window. To create a Text Editor window that is 600 pixels wide x 400 pixels tall, anchored at the upper left corner, we would do the following:

function MakeTextWnd(sTitle,w,h)

-- make a function to do this

  local wMira,hMira = GetViewportSize()

-- maximum width and height

  local R = new_rect()

-- create a CRect object

  R:Set(0,w/wMira,0,h/hMira)

-- scale to the viewport

  local W = CreateTextWindow(sTitle,R)

-- format the string

  R:delete()

-- no longer needed.

  return W

-- return the window reference

end

 

 

 

T = MakeTextWnd("My Title",600,400)

-- is returned the window pointer T

Related Topics

CRect


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.