I'm iterating through the items in a MD List -see below
I want to set the drawstyle based on the list content but I don't know how to extract the value
For Each(#l) In(#List.Items)
#wrk9n0 += 1
If Cond(#wrk9n0.Mod( 2 ) = 0)
#l.ThemeDrawStyle := 'AlternateItem'
Else
#l.ThemeDrawStyle := ''
Endif
Endfor
I can prompt to
#l.Items<#columnSTDID1>.
But the error says 'Expression #columnSTDID1 does not contain default property'
I'm guessing I have to cast it as something but I don't know what.
Accessing MD List field values
Re: Accessing MD List field values
Are you binding your list entries to a field?
If so, you can use #l.Entry to get the entry number.
The only other way I know of is to use the CurrentItem of the PRIM_MD.List* control
Joe
If so, you can use #l.Entry to get the entry number.
Code: Select all
begin_com role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignRed>)
define_com class(#PRIM_TBLO) name(#LayoutList)
define_com class(#PRIM_TBLO.Column) name(#LayoutListColumn1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Row) name(#LayoutListRow1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Item) name(#LayoutListItem1) Alignment(TopLeft) Column(#LayoutListColumn1) Manage(#ListSTD_INT1) Parent(#LayoutList) Row(#LayoutListRow1)
define_com class(#PRIM_MD.List) name(#List) DisplayPosition(1) LayoutManager(#LayoutList) Left(435) Parent(#COM_OWNER) RowHeight(48) TabPosition(1) ThemeDrawStyle('Card') Top(123)
define_com class(#PRIM_MD.ListLabel) name(#ListSTD_INT1) Caption('Standard Integer field') DisplayPosition(1) DragStyle(None) Left(0) Parent(#List) Source(#STD_INT) TabPosition(1) Top(0) Height(48) Width(278)
define_com class(#PRIM_MD.RaisedButton) name(#Button) Caption('BUTTON') DisplayPosition(2) Left(236) Parent(#COM_OWNER) TabPosition(2) ThemeDrawStyle('MediumTitle') Top(278)
evtroutine handling(#Com_owner.Initialize)
define_com class(#PRIM_NMBR) name(#lIndex)
#lIndex := 1
dountil (#lIndex > 10)
#STD_INT := #lIndex
add_entry to_list(#List)
#lIndex += 1
enduntil
endroutine
mthroutine name(IterateList)
for each(#lItem) in(#List.Items)
get_entry number(#lItem.Entry)
#SYS_WEB.Console.Log( #STD_INT.AsString )
endfor
endroutine
evtroutine handling(#Button.Click)
#COM_OWNER.IterateList
endroutine
end_com
Code: Select all
begin_com role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignRed>)
define_com class(#PRIM_TBLO) name(#LayoutList)
define_com class(#PRIM_TBLO.Column) name(#LayoutListColumn1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Row) name(#LayoutListRow1) DisplayPosition(1) Parent(#LayoutList)
define_com class(#PRIM_TBLO.Item) name(#LayoutListItem1) Alignment(TopLeft) Column(#LayoutListColumn1) Parent(#LayoutList) Row(#LayoutListRow1)
define_com class(#PRIM_MD.List) name(#List) DisplayPosition(1) LayoutManager(#LayoutList) Left(435) Parent(#COM_OWNER) TabPosition(1) ThemeDrawStyle('Card') Top(123)
define_com class(#PRIM_MD.ListEdit) name(#Edit) Caption('Caption') DisplayPosition(1) DragStyle(None) Left(0) Parent(#List) TabPosition(1) Top(0) Width(278)
define_com class(#PRIM_MD.RaisedButton) name(#Button) Caption('BUTTON') DisplayPosition(2) Left(236) Parent(#COM_OWNER) TabPosition(2) ThemeDrawStyle('MediumTitle') Top(278)
evtroutine handling(#Com_owner.Initialize)
define_com class(#PRIM_NMBR) name(#lIndex)
#lIndex := 1
dountil (#lIndex > 10)
add_entry to_list(#List)
#Edit.CurrentItem.Value := #lIndex.AsString
#lIndex += 1
enduntil
endroutine
mthroutine name(IterateList)
for each(#lItem) in(#List.Items)
get_entry number(#lItem.Entry) from_list(#List)
#SYS_WEB.Console.Log( #Edit.CurrentItem.Value )
endfor
endroutine
evtroutine handling(#Button.Click)
#COM_OWNER.IterateList
endroutine
end_com
Re: Accessing MD List field values
Thank you
get_entry number(#lItem.Entry)
was exactly what I was after!
Jim
get_entry number(#lItem.Entry)
was exactly what I was after!
Jim