Tree View Issue

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Tree View Issue

Post by soa »

I have a tree view to which I'm adding various RPs. I'm catching the #treeItems.ItemGotFocus event to determine which is the active item.

One of my RPs has a text box element and when I click into the textbox the above event fires.

But another contains a DateTime Picker and if I click on the white area of the date box or I use the event fires but if instead I click on the first part of the date (as in 22 in 22/12/2017) then the itemGotFocus does not fire. If I click on the down arrow to the month view the itemGotFocus again does not fire.

Since anyone change. How can I capture these events in the RP and propagate them back to the tree as itemGotFocus events.

Cheers
GregSippel
Posts: 25
Joined: Thu May 19, 2016 11:34 am

Re: Tree View Issue

Post by GregSippel »

Soa,

The answer is very close to a question asked by jyoung, see here viewtopic.php?f=3&t=1695&sid=3402ea900c ... 9284dc0f17

In your Tree Item Design, signal an event when the DateTime Picker get focus like this

Code: Select all

Define_Evt Name(DateTimeGotFocus)


Evtroutine Handling(#DateTime1.GotFocus)

#SYS_WEB.Console.Log( ('Item Design Evtroutine Handling(#DateTime1.GotFocus)') )
Signal Event(DateTimeGotFocus)

Endroutine

Then in the component that uses the tree view, you need the capture the event. To do this first we need a global variable to hold the reference item we wish to here events from

Code: Select all

Define_Com Class(#gbsTestTreeEventsDesign) Name(#CurrentDesign) Reference(*DYNAMIC)
Now we have this, we can capture the reference item like this

Code: Select all

Evtroutine Handling(#Tree1.ItemMouseHover) Item(#Item)

#CurrentDesign <= (#Item.Design *As #gbsTestTreeEventsDesign)

Endroutine
and finally, we can hear the events via this

Code: Select all

Evtroutine Handling(#CurrentDesign.DateTimeGotFocus) Com_Sender(#Sender)

#SYS_WEB.console.log( ('#Tree1.ItemGotFocus by sender ' + #Sender.name + ' and Item ' + #Tree1.CurrentItem.Entry.AsString) )

Endroutine
Hope this helps.

Cheers
Greg
Post Reply