Page 1 of 1

TRIM_TREE (Item)LostFocus not firing?

Posted: Fri Apr 19, 2019 11:13 pm
by pkoopmanpk
On a webpage I created a PRIM_TREE and a PRIM_PANL that implements PRIM_TREE.iTreeDesign.

While testing it looks like some events are not firing.

When tabbing out of the last element in the list, it looks like the TRIM_TREE.ItemLostFocus and TRIM_TREE.LostFocus are not firing.

When shift-tabbing out of the first element in the list, it looks like only the TRIM_TREE.ItemLostFocus is not firing.

Is this by design, or is this a bug?

Sample code:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_MD.FlatButton) Name(#ButtonBefore) Caption('Before') DisplayPosition(1) Parent(#COM_OWNER) TabPosition(1) ThemeDrawStyle('Borders1+BorderTheme500+ForegroundMediumPrimary') Height(42)
Define_Com Class(#PRIM_TREE<#xDemoTreeDesign>) Name(#ListPackages) DisplayPosition(2) Parent(#COM_OWNER) TabPosition(2) Height(354) Width(569) ThemeDrawStyle('Card') Left(5) Top(63)
Define_Com Class(#PRIM_MD.FlatButton) Name(#ButtonAfter) Caption('After') DisplayPosition(3) Left(5) Parent(#COM_OWNER) TabPosition(3) ThemeDrawStyle('Borders1+BorderTheme500+ForegroundMediumPrimary') Top(424) Height(42)

Evtroutine Handling(#Com_owner.Initialize)
Define_Com Class(#Prim_nmbr) Name(#counter)
* Fill list with dummy data
Begin_Loop Using(#counter) To(3)
#STD_TEXT := ('Box #&1').Substitute( #counter.AsString )
Add_Entry To_List(#ListPackages)

Evtroutine Handling(#ButtonBefore.GotFocus)
#SYS_WEB.Console.Log( 'Before got focus' )
Evtroutine Handling(#ButtonBefore.LostFocus)
#SYS_WEB.Console.Log( 'Before lost focus' )
Evtroutine Handling(#ListPackages.GotFocus)
#SYS_WEB.Console.Log( 'List got focus' )
Evtroutine Handling(#ListPackages.LostFocus)
#SYS_WEB.Console.Log( 'List lost focus' )
Evtroutine Handling(#ButtonAfter.GotFocus)
#SYS_WEB.Console.Log( 'After got focus' )
Evtroutine Handling(#ButtonAfter.LostFocus)
#SYS_WEB.Console.Log( 'After lost focus' )
Evtroutine Handling(#ListPackages.ItemGotFocus)
#SYS_WEB.Console.Log( 'Item got focus' )
Evtroutine Handling(#ListPackages.ItemLostFocus)
#SYS_WEB.Console.Log( 'Item Lost focus' )
Console log when using tab:
Before lost focus
List got focus
Item got focus
Item Lost focus
Item got focus
Item Lost focus
Item got focus
After got focus
Thinking about it, the item not losing focus would be correct, because in the context of the list it is the focused item. But the list not losing focus is a problem, because it's the last control on the form, and I want to do some validating when the list is left.

Re: TRIM_TREE (Item)LostFocus not firing?

Posted: Tue Apr 23, 2019 9:48 am
by MarkD
Could you put a 1x1 pixel transparent borderless push button (say) after the tree so that the user could tab out of the list to it?

Re: TRIM_TREE (Item)LostFocus not firing?

Posted: Tue Apr 23, 2019 5:34 pm
by pkoopmanpk
Thank you, I'll look into that.

For now I created a class that communicates with the tree item via RelatedReference.