static function RectField (value : Rect, params options : GUILayoutOption[]) : Rect
static function RectField (label : string, value : Rect, params options : GUILayoutOption[]) : Rect
static function RectField (label : GUIContent, value : Rect, params options : GUILayoutOption[]) : Rect
Rect - The value entered by the user.
返回Rect,由用户输入的值。
Description描述
Make an X, Y, W & H field for entering a Rect.
制作 X, Y, W & H字段用于输入矩形。
Modify Another's window position and size values.
修改其他窗口位置和大小的值。
// Simple Script that lets you modify another's window position value
//修改其他窗口位置的值
// To use this script you need to open first the DummyWindow window.
//使用这个脚本必须首先打开DummyWindow窗口
class MoveResizeSelectedWindow extends EditorWindow {
var pos : Rect;
@MenuItem("Examples/Move - Resize other window")
static function Init() {
var window = GetWindow(MoveResizeSelectedWindow);
window.Show();
}
function OnGUI() {
DummyWindow.instance.position =
EditorGUILayout.RectField("Window's position:",
DummyWindow.instance.position);
if(GUILayout.Button("Reset position"))
DummyWindow.instance.position = Rect(0,0,200,200);
if(GUILayout.Button("Close"))
this.Close();
}
}
And the script that works with the example:
窗口的例子
// Dummy window that is going to be moved.
//窗口将被移动
class DummyWindow extends EditorWindow {
static var instance;
@MenuItem("Examples/Dummy Window")
static function Init() {
var window = GetWindow(DummyWindow);
window.Show();
}
function DummyWindow() {
instance = this;
}
}