You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Realizeは動的にコンポーネントを作成するためのメソッドです。
コントロール (PRIM_CTRL) のメンバ

詳細


Realize メソッドは、コントロールインスタンスの UI 部分を作成します。これは、デスクトップアプリケーションにのみ適用されます。
ビジュアルコンポーネントには 3 つの状態があります。

  1. NULL
  2. Unrealized
  3. Realized


Null コンポーネントは効果的に使用できないオブジェクトです。それらはまだ作成されていないため、インスタンスはありません。
未実現コンポーネントは作成され、有効ですが、コントロールの UI 機能が作成されていないため、画面には表示されません。
実現されたコンポーネントは完全に生きています。
静的に定義されたコンポーネントは、 LANSA ランタイムによって自動的に実現されます。ただし、動的に作成されたコンポーネントは、実現されているコントロールの親でない限り、実現する必要があります。
コンポーネントの実現は比較的遅いため、コンポーネントを一括して実現することが最善です。


この例では、ボタンと関連するレイアウト項目が動的に作成されます。
Realized チェックボックスがオンの場合、ボタンは作成時に実現されます。
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Caption('Dynamic Creation') Height(397) Left(227) Top(218) Width(512) Clientwidth(496) Clientheight(358) Layoutmanager(#TableLayout)
Define_Com Class(#PRIM_TBLO) Name(#TableLayout)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#TableLayout) Width(112) Units(Pixels)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column2) Displayposition(2) Parent(#TableLayout) Width(1.64)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#TableLayout)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem1) Alignment(TopCenter) Column(#Column1) Flow(Down) Manage(#Create) Parent(#TableLayout) Row(#Row1) Sizing(None) Margintop(4)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem2) Alignment(TopCenter) Column(#Column1) Flow(Down) Manage(#Realize) Parent(#TableLayout) Row(#Row1) Sizing(None) Margintop(4)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem3) Alignment(TopCenter) Column(#Column1) Flow(Down) Manage(#RealizeAll) Parent(#TableLayout) Row(#Row1) Sizing(None)
Define_Com Class(#PRIM_PHBN) Name(#Create) Caption('Create a button') Displayposition(1) Left(9) Parent(#COM_OWNER) Tabposition(1) Top(4) Width(95)
Define_Com Class(#PRIM_CKBX) Name(#Realize) Caption('Realized') Displayposition(2) Left(9) Marginleft(2) Parent(#COM_OWNER) Tabposition(2) Top(33) Height(28) Width(95) Buttonstate(Checked)
Define_Com Class(#PRIM_PHBN) Name(#RealizeAll) Caption('Realize All') Displayposition(3) Left(9) Parent(#COM_OWNER) Tabposition(3) Top(61) Width(95)
Define_Com Class(#Prim_acol<#Prim_phbn>) Name(#Buttons)
Define_Com Class(#Prim_acol<#Prim_TBLO.Item>) Name(#LayoutItems)
Evtroutine Handling(#Create.Click)

  • Create a button instance
    #Buttons.Insert( (*New #prim_phbn) )
    #Buttons.Last.Caption := ("Button &1").Substitute( #Buttons.ItemCount.Asstring )
    #Buttons.Last.Parent <= #Com_owner
  • Create a layout item to manage the button position
    #LayoutItems.Insert( (*New #prim_tblo.Item) )
    #LayoutItems.Last.Column <= #Column2
    #LayoutItems.Last.Row <= #Row1
    #LayoutItems.Last.Alignment := TopLeft
    #LayoutItems.Last.Flow := Down
    #LayoutItems.Last.Sizing := None
    #LayoutItems.Last.MarginTop #LayoutItems.Last.MarginLeft := 4
    #LayoutItems.Last.Parent <= #TableLayout
    #LayoutItems.Last.Manage <= #Buttons.Last
    If (#Realize.ButtonState = Checked)
    #Buttons.Last.Realize
    Endif
    Endroutine
    Evtroutine Handling(#RealizeAll.Click)
    #Com_owner.Realize
    Endroutine
    End_Com

    参照

    すべてのコンポーネント クラス
    テクニカルリファレンス
  • No labels