Signaling Events from a Tile Item

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
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Signaling Events from a Tile Item

Post by jyoung »

I have a Tile Item that contains a button. I would like to bubble up the button's click event (via signal) to up to the parent component like the PRIM_TILE.ItemClick event.

I've defined a "Remove" event in the Tile, but I can't subscribe to it.

This gives me an error stating PRIM_TILE<MYTILEP01> does not contain an event REMOVE.

Code: Select all

evtroutine handling(#MyTiles.Remove)
* trigger deletion
endroutine
Ok, I understand that, as the event is on MYTILEP01 not on PRIM_TILE.

I've also tried using the iterator such as MyTiles<>.Remove but that gives me the "Expression is not an iterator" error.

How do you signal events up from a Tile?

I think I could do this with an application scoped object, but is there a way to do it with one?

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

Re: Signaling Events from a Tile Item

Post by GregSippel »

Joe,

In order to get a reference to the tile item design, I think (as I haven't tested it yet) you need the following,

1) In component that has the PRIM_TILE defined in it create a global variable that is dynamic that is the same class as the item design, such as

Define_com Class(#YourTileDesign) Name(#ActiveTile) Reference(*DYNAMIC)

2) Since the user will need to move the mouse over the tile design to get to the button you can the ItemMouseEnter event of the PRIM_TILE to capture the needed reference, like this

Evtroutine Handling(#TileControl.ItemMouseEnter)

#ActiveTile <= (#TileControl.CurrentItem.Design *As #YourTileDesign)

Endroutine

3) You should be able to hear the events in the component that contains the PRIM_TILE by doing

Evtroutine Handling(#ActiveTile.YourEvent)

* Actions for Event

Endroutine

The same technique should enable to also call methods directly as well. Also, you can consider using a collection of the item design if you wish to call a method in all of them, so as you are adding Tile Items to the PRIM_TILE you would do the following

#YourTileDesignsCollection.Insert( (#TileControl.CurrentItem.Design *As #YourTileDesign) )

This means you can now do things like

#YourTileDesignsCollection<>.Remove

Hope this helps

Cheers
Greg
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Signaling Events from a Tile Item

Post by jyoung »

Brilliant. Both techniques work well.

I was struggling with getting a hold of the reference, did not thing to capture it in the mouse over. Tried it with Focus and that seems to work too.

Thanks!
Joe
Post Reply