# Triggering events

**URL:** <https://techcommunity.softwareag.com/t/triggering-events/100348>\
**Category:** Forum\
**Tags:** mobile\
**Created:** [February 14, 2012, 10:31pm UTC](https://techcommunity.softwareag.com/t/triggering-events/100348 "2012-02-14T22:31:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Gallego](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/javier_gallego/32/77_2.png) [@Javier\_Gallego](https://techcommunity.softwareag.com/u/Javier_Gallego)\
**Post date:** [February 14, 2012, 10:31pm UTC](https://techcommunity.softwareag.com/t/triggering-events/100348/1 "2012-02-14T22:31:09Z")

</div>

Hi  
I see in the samples that to trigger an event from a “non-MyCanvas” thread, I have to use something like  
nUIController.eventListenerQueue(object, nUIConstants.EVT\_TRIGGER\_HTTP\_SUCCESS);  
How would I trigger an event from inside the “MyCanvas” thread? I would like to close an alert dialog and do a transition (back) but have the problem that the alert dialog is handled in one listener and the back button is handled in a different listener.  
My sample: I go from Login View (default nUIEventListener) → Inbox View (default nUIEventListener) → Details (second nUIEventListener).  
I tried the following:  
nUIController.transitionFrom(pop\_up\_dialog);  
nUIButtonElement dummyBackBtn = new nUIButtonElement(NUIID\_BACK\_BUTTON, “Back”);  
nUIController.eventListenerQueue(dummyBackBtn, nUIConstants.EVT\_TRIGGER);

This works in Android (not in Phoney though), but after that, the back button from the “Inbox View” reacts as the back button from the “Details”.  
Many thanks,  
Javier

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [February 15, 2012, 12:23am UTC](https://techcommunity.softwareag.com/t/triggering-events/100348/2 "2012-02-15T00:23:00Z")

</div>

Hi Javier,

I might be misunderstanding, but why don’t you just queue a custom event on the alert dialog that dismisses and kicks off the transition? Ie: nUIController.eventListenerQueue (alert\_dialog, CUSTOM\_EVENT\_0);

The transitionFrom call you are making will potentially set up things like back buttons, etc. so that when you create your dummy button as the back button it overrides the previous back button that was set up by transitionFrom, if that makes sense. If your idea is to transition from your Details View (that has the alert dialog on top of it) back to the Inbox View I am pretty sure you can just .transitionFrom (pop\_up\_dialog) and then either trigger the back button that was defined for the Details View or skip the event queue processing for back and directly transitionToView(inbox\_view).

One thing you can keep in mind is that you should be getting EVT\_TRANSITION\_FROM\_COMPLETE on an element (say a popup dialog) when a transition finishes, so you can then queue events after that.

Cheers,

Spencer

---

<div class="post-metadata">

**Author:** ![Javier\_Gallego](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/javier_gallego/32/77_2.png) [@Javier\_Gallego](https://techcommunity.softwareag.com/u/Javier_Gallego)\
**Post date:** [February 15, 2012, 2:22pm UTC](https://techcommunity.softwareag.com/t/triggering-events/100348/3 "2012-02-15T14:22:01Z")

</div>

Hi Spencer  
That is exactly what I am doing right now. First transitionFrom the pop\_up\_dialog and then transitionToView (inside the handling for the back button). This works fine in iOS, but not in Android, where the back button from the Inbox acts as the back button from the Details.  
But your hint on the EVT\_TRANSITION\_FROM\_COMPLETE is a good one to follow, since it is probably the safest way to do what I want. I’ll give it a try and see how it works.  
Many thanks  
Javier

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:01pm UTC](https://techcommunity.softwareag.com/t/triggering-events/100348/4 "2021-04-02T15:01:52Z")

</div>


