Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4328] Android: "hide()" Does Nothing Before Window Opens

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2017-06-05T22:41:19.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sBacklog
ComponentsAndroid
Labelsn/a
ReporterDawson Toth
AssigneeEric Merriman
Created2011-06-06T12:36:07.000+0000
Updated2017-06-05T22:41:19.000+0000

Description

Problem

Calling "hide()" on a button doesn't hide the button if it is called before the window "open" event fires.

Sample Code

var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.open();

var hiddenButton = Ti.UI.createButton({
    title: 'If you can see me, FAIL!',
    height: 40, width: 90,
    top: 45, left: 225,
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(hiddenButton);
hiddenButton.hide();

// Workaround: uncomment the following 3 lines and the button will be hidden.
//win.addEventListener('open', function() {
//    hiddenButton.hide();
//});

Workaround

Listen for the 'open' event on the window, and call "hide()" then. See the commented code at the bottom of the code sample above to see this in action.

Associated Helpdesk Ticket

http://appc.me/c/APP-321235

Comments

  1. Chris Hoopes 2011-08-08

    The workaround worked just fine for me. Thanks for the fix.
  2. Lee Morris 2017-06-05

    Closing ticket as fixed.

JSON Source