Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Is it possible to dynamically change the orientation of a layout?

    Hi,

    I want to make a Layout that behaves like a VLayout when in portrait mode and a HLayout in landscape mode. I tried using the following code, but it has no effect:
    Code:
    isc.Layout.create({ID:"layout", autoDraw:false, members:[pane1, pane2]});
    function oChange() {
      if (isc.Page.getOrientation() == "portrait")
        layout.orientation = "vertical";
      else if (isc.Page.getOrientation() == "landscape")
        layout.orientation = "horizontal";
      layout.reflow();
    }
    isc.Page.setEvent("orientationChange", oChange);
    My function gets called when orientation is changed, but doesn't seem to have any effect. I have also tried calling layout.layoutChildren() and layout.redraw() to no avail.
    Is it possible to achieve what I'm trying to do?

    regards,
    Andrew

    #2
    Never mind, I've found the answer to my own question. Code should have been:
    Code:
    isc.Layout.create({ID:"layout", autoDraw:false, members:[pane1, pane2]});
    function oChange() {
      if (isc.Page.getOrientation() == "portrait")
        layout.vertical = false;
      else if (isc.Page.getOrientation() == "landscape")
        layout.vertical = true;
      layout.reflow();
    }
    isc.Page.setEvent("orientationChange", oChange);

    Comment

    Working...
    X