I seem to be having trouble with this. I want to make my desktop app open to the width and height of the users window. I don't want "fullscreen" as such as that hides the menu bar - at least on the Mac. By reading other posts this ought to work - but not for me.
I've tried the following code both before and after window.onload and the window size remains as set in tiapp.xml. Obviously I am missing something.
var currentWindow = Titanium.UI.getMainWindow(); currentWindow.setWidth = screen.width; currentWindow.setHeight = screen.height;SDK: 1.0.1 (desktop)
3 Answers
Accepted Answer
The code
var currentWindow = Titanium.UI.getCurrentWindow(); currentWindow.setWidth = screen.width; currentWindow.setHeight = screen.height;is incorrect. you actually need:
var currentWindow = Titanium.UI.GetCurrentWindow(); currentWindow.setWidth(screen.width); currentWindow.setHeight(screen.height);Both setWidth and setHeight are methods of the UserWindow object
You need to get the current window
var currentWindow = Titanium.UI.getCurrentWindow(); currentWindow.setWidth = screen.width; currentWindow.setHeight = screen.height;
** Duplicate Removed **
Your Answer
Think you can help? Login to answer this question!