To start with I have 4 #PRIM_TBLO.Rows already defined.
After I create the grid with panels in the first row, a button is added that spans 2 of the columns using the Layout Item (#PRIM_TBLO.Item)
There is a click event for the buttons which loops on the array of #PRIM_TBLO.Item to find the one managing the button and change the ColumnSpan from 2 to 1.
I was hoping the button would shrink in size to be only be in one panel but it is not.
What am I missing?
Tried several methods but nothing works.
Glynn
Code: Select all
* Collections for the buttons, panels and layoutitems being created dynamically
Define_Com Class(#Prim_acol<#PRIM_TBLO.Column>) Name(#loColumns)
Define_Com Class(#Prim_acol<#PRIM_TBLO.Row>) Name(#loRows)
Define_Com Class(#Prim_acol<#Prim_tblo.Item>) Name(#LayoutItemPanels)
Define_Com Class(#Prim_acol<#Prim_tblo.Item>) Name(#LayoutItemBottons)
Define_Com Class(#Prim_acol<#Prim_panl>) Name(#Panels)
Define_Com Class(#Prim_acol<#PRIM_PHBN>) Name(#Buttons)
Define Field(#wDate) Type(*Date)
Evtroutine Handling(#Com_owner.Initialize)
#wDate := #wDate.Now
Begin_Loop Using(#STD_INT) To(10)
#wDate := #wDate.Adjust( 1 )
* #SYS_WEB.Console.Log( #STD_INT.AsString )
* #SYS_WEB.Console.Log( #wDate.AsDayOfWeek )
* #SYS_WEB.Console.Log( #wDate.AsDisplayString( CCYYMMDD ) )
#loColumns.Insert( (*New #PRIM_TBLO.Column) )
#loColumns.Last.Parent <= #LayoutMain
#loColumns.Last.DisplayPosition := #STD_INT
#loColumns.Last.Units := Proportion
#loColumns.Last.Width := 1.0
#loColumns.Last.ComponentTag := #wDate.AsDisplayString( MMsDDsCCYY )
#Panels.Insert( (*New #Prim_panl) )
#Panels.Last.Parent <= #COM_OWNER
If Cond((#wDate.AsDayOfWeek *EQ 'SATURDAY') *Or (#wDate.AsDayOfWeek *EQ 'SUNDAY'))
#Panels.Last.Style <= #WeekendStyle
Else
#Panels.Last.Style <= #WeekdayStyle
Endif
#LayoutItemPanels.Insert( (*New #PRIM_TBLO.Item) )
#LayoutItemPanels.Last.Parent <= #LayoutMain
#LayoutItemPanels.Last.Sizing := FitBoth
#LayoutItemPanels.Last.Alignment := Center
#LayoutItemPanels.Last.Flow := None
#LayoutItemPanels.Last.Column <= #loColumns.Last
#LayoutItemPanels.Last.Row <= #LayoutMainRow1
#LayoutItemPanels.Last.Manage <= #Panels.Last
End_Loop
* add button
#Buttons.Insert( (*New #PRIM_PHBN) )
#Buttons.Last.Parent <= #COM_OWNER
#Buttons.Last.DisplayPosition := 1
#Buttons.Last.Caption := #loColumns.Item<4>.ComponentTag
#Buttons.Last.ComponentTag := #loColumns.Item<4>.ComponentTag
#LayoutItemBottons.Insert( (*New #PRIM_TBLO.Item) )
#LayoutItemBottons.Last.Parent <= #LayoutMain
#LayoutItemBottons.Last.Sizing := FitToWidth
* #LayoutItemBottons.Last.Alignment := Center
#LayoutItemBottons.Last.Marginleft := 20
#LayoutItemBottons.Last.Marginright := 20
#LayoutItemBottons.Last.Columnspan := 2
#LayoutItemBottons.Last.Flow := None
#LayoutItemBottons.Last.Column <= #loColumns.Item<4>
#LayoutItemBottons.Last.Row <= #LayoutMainRow1
#LayoutItemBottons.Last.Manage <= #Buttons.Last
Endroutine
Evtroutine Handling(#Buttons<>.Click) Com_Sender(#Button)
#SYS_WEB.Console.Log( ('button: ' + #Button.ComponentTag) )
For Each(#LayoutItemBotton) In(#LayoutItemBottons)
#SYS_WEB.Console.Log( ('#LayoutItemBotton: ' + #Button.ComponentTag) )
If Cond(#LayoutItemBotton.ComponentTag *EQ #Button.ComponentTag)
#LayoutItemBotton.ColumnSpan := 1
#Button.Scale Scalewidth(1) Scaleheight(1)
Leave
Endif
Endfor
Endroutine