HTML5BuilderのButtonコンポーネントを使ってみる

Captionプロパティ

Captionプロパティはボタンのテキスト文字を示します。

function Button1Click($sender, $params)
{
   $this->Button1->Caption = "Hello, World!";
}

Colorプロパティ

Colorプロパティはボタンの色を示します。

function Button2Click($sender, $params)
{
   $r = dechex(rand(0, 255));
   $g = dechex(rand(0, 255));
   $b = dechex(rand(0, 255));
   $this->Button2->Color = "#$r$g$b";
}

Enableプロパティ

Enableプロパティをfalseにするとボタンを無効になります。

Fontプロパティ

Fontプロパティはボタンのフォントを示します。

$this->Button7->Font->Family = "Verdana";
$this->Button7->Font->Align = taCenter;
$this->Button7->Font->Size = "16px";
$this->Button7->Font->Weight = "bold";
$r = dechex(rand(0, 255));
$g = dechex(rand(0, 255));
$b = dechex(rand(0, 255));
$this->Button7->Font->Color = "#$r$g$b";

Hintプロパティ

Hintプロパティはボタンのヒントを示します。

ImageSourceプロパティ

ImageSourceプロパティはボタンの画像を示します。

ButtonTypeプロパティ

ButtonTypeプロパティはボタンのタイプ(inputタグのtype属性)を示します。

  • btSubmit

    ボタンをクリックすると、sumitします。

  • btReset

    ボタンをクリックすると、input欄をリセットします。

  • btNormal

    普通のボタンです。クリックしてもsubmitしません。

クリックイベントの$sender引数

クリックイベントの$sender引数には、押されたボタンが入ります。

function Button9Click($sender, $params)
{
   $this->Label2->Caption = "Clicked button: " . $sender->Name;
}

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください