Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Cancel a close event

Is there a way to cancel the close event - ie when a user hits the back button?

I have a window, which displays a popup view in response to user input. I'd like to close the popup if it's open - otherwise close the window.

I have an event listening on the window itself - there's no close event on views.

There doesn't appear to be a property on the args passed to the event and returning true/false when you have a listener on the window doesn't appear to do anything.

— asked May 23rd 2010 by David Ashwood
  • android
  • cancel
  • events
  • view
0 Comments

5 Answers

  • I think this might be related to https://appcelerator.lighthouseapp.com/projects/32238/tickets/824-parent-events-fired-when-child-view-has-same-event-callback which appears to have made it only to the iPhone tree

    — answered May 23rd 2010 by David Ashwood
    permalink
    0 Comments
  • is there any known and working workaround since that time?

    — answered July 19th 2010 by Jicks Steen
    permalink
    0 Comments
  • Couple ways i could think of
    1)
    Open another window with opacity lower than the view, add view to the window, technically, that window blocks the background window with back button and they can't click on it without closing or respond to the pop-op view.
    2) Assign null to the pop-up view first before creating one, then check if the pop-up has engaged on back button, close it if it does.
    ~~~

    — answered May 23rd 2010 by Daniel Lim
    permalink
    0 Comments
  • Aye - the first is the work-around I'm testing.
    The 2nd doesn't help - I'm doing this already which works - but the close behaviour still triggers the window close.

    — answered May 23rd 2010 by David Ashwood
    permalink
    0 Comments
  • Humm - the work around doesn't work - unless the window is fullscreen the close event gets fired on the parent window.

    It also appears that you can't open a modal window without it being fullscreen - passing {modal:true, fullscreen:false} doesn't change the behaviour.

    — answered May 23rd 2010 by David Ashwood
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.