2024 年 PHP 日本會議

視窗

(UI 0.9.9)

簡介

表示一個 UI 視窗

類別概要

class UI\Window extends UI\Control {
/* 屬性 */
protected $controls;
/* 建構函式 */
public __construct(string $title, Size $size, bool $menu = false)
/* 方法 */
公開 新增(UI\Control $control)
公開 錯誤(字串 $title, 字串 $msg)
公開 訊息(字串 $title, 字串 $msg)
保護 關閉中(): 整數
公開 開啟(): 字串
公開 儲存(): 字串
公開 設定邊框(布林值 $borders)
公開 設定邊距(布林值 $margin)
公開 設定大小(UI\Size $size)
公開 設定標題(字串 $title)
/* 繼承的方法 */
}

屬性

控制項

包含控制項,不應直接操作

目錄

新增註解

使用者貢獻的註解 1 則註解

everton3x at gmail dot com
7 年前
這是 UI 函式庫中精靈佈局的範例

<?php

/*
* Wizard sample layout builded with PHP UI
*/

use UI\Window;
use
UI\Size;
use
UI\Controls\Button;
use
UI\Controls\Grid;
use
UI\Controls\Box;
use
UI\Controls\Form;
use
UI\Controls\Entry;
use
UI\Controls\Label;

/*
* The window
*/
$window = new Window('Wizard Sample Layout', new Size(640, 480), TRUE);
$window->setMargin(true);

/*
* Wizard content (sample)
*/
$content = new Form();
$content->setPadded(true);
$content->append('User:', new Entry());
$content->append('Password:', new Entry(Entry::Password));

/*
* Layout to title, content and buttons
*/
$grid = new Grid();
$grid->setPadded(false);

/*
* Title
*/
$grid->append(new Label('Wizard Sample'), 0, 0, 6, 1, true, Grid::Fill, false, Grid::Fill);

/*
* Append content
*/
$grid->append($content, 0, 1, 6, 1, false, Grid::Fill, true, Grid::Fill);

/*
* Left buttons
*/
$left_box = new Box(Box::Horizontal);
$left_box->append(new Button('&About'));
$left_box->append(new Button('&Help'));

/*
* Right buttons
*/
$right_box = new Box(Box::Horizontal);
$right_box->append(new Button('&Back'));
$right_box->append(new Button('&Forward'));
$right_box->append(new Button('&Close'));

/**
* Append buttons
*/
$grid->append($left_box, 0, 2, 1, 1, true, Grid::Start, false, Grid::Fill);
$grid->append($right_box, 5, 2, 1, 1, true, Grid::End, false, Grid::Fill);

/*
* Append layout and show.
*/
$window->add($grid);

$window->show();

UI\run();

?>
To Top