Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Control - Realize Method

Panel
bgColor#2c3c4c

Creates the visual portion of dynamically created controls

Member of Control (PRIM_CTRL)

...

The buttons are realized on creation if the Realized checkbox is checked.

     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


See also

All Component Classes

Technical Reference