setPaneDimensions

Hi Mobile Community,

I have created a view which uses the “split screen”-Feature. When I hit the back Button in that view I like to get rid of the split screen. For that I have two functions:

   [b]public[/b] [b]int[/b] sidepane = 1;

   [b]public[/b] [b]int[/b] mainpane = 0;

public void setPaneDimensions()

   {

         [b]if[/b] (TABLET_LAYOUT)

         {

                [b]int[/b] sidepane_width = Math.[i]min[/i] (([i]CURRENT_SCREEN_WIDTH[/i] * 40) / 100, [i]CURRENT_SCREEN_PPI[/i] * 2);



                [b]int[/b] height = main_window.getHeight ();

                main_window.setPaneDimensions (sidepane, [b]new[/b] [b]int[/b] [] { 0, 0, sidepane_width, height });

                main_window.setPaneDimensions (mainpane, [b]new[/b] [b]int[/b] [] { sidepane_width, 0, [i]CURRENT_SCREEN_WIDTH[/i] - sidepane_width, height });



         }

   }

  

   [b]public[/b] [b]void[/b] unsetPaneDimensions()

   {

         main_window.setPaneDimensions(mainpane, [b]new[/b] [b]int[/b] [] {0, 0, [i]CURRENT_SCREEN_WIDTH[/i], [i]CURRENT_SCREEN_HEIGHT[/i] });

         main_window.setPaneDimensions(sidepane, [b]new[/b] [b]int[/b] [] {0, 0, 0, 0 });

   }

The first function I call to enable the split screen that part is working.

In the second function I try to make the mainpane (index 0) full screen again to use it with the common transitionToView method. But then I get an exception:

xception in thread "Thread-5" java.lang.IllegalArgumentException

   at com.softwareag.mobile.runtime.nui.nUIDisplayObject.setWidth(  [u]   nUIDisplayObject.java:145  [/u])

   at com.softwareag.mobile.runtime.nui.nUIWindowDisplay.setPaneViewDimensions(  [u]   nUIWindowDisplay.java:319  [/u])

   at com.softwareag.mobile.runtime.nui.nUIWindowDisplay.setPaneDimensions(  [u]   nUIWindowDisplay.java:291  [/u])

   at com.softwareag.mobile.iprmobile.MyCanvas.unsetPaneDimensions(  [u]   MyCanvas.java:84  [/u])

   at com.softwareag.mobile.iprmobile.MyCanvas.nUIEventCallback(  [u]   MyCanvas.java:635  [/u])

   at com.softwareag.mobile.runtime.nui.nUIController.eventListenerCallback(  [u]   nUIController.java:427  [/u])

   at com.softwareag.mobile.runtime.nui.nUIController.runOnce(  [u]   nUIController.java:188  [/u])

   at com.softwareag.mobile.runtime.core.CanvasNativeUI.fixedRateUpdate(  [u]   CanvasNativeUI.java:67  [/u])

   at com.softwareag.mobile.runtime.core.CanvasCore.runOnce(  [u]   CanvasCore.java:387  [/u])

   at com.softwareag.mobile.runtime.core.CanvasThreading.run(  [u]   CanvasThreading.java:92  [/u])

   at java.lang.Thread.run(  [u]   Thread.java:662  [/u])

Any idea how to get rid of panes at all? Something like removePanes()?

Thanks and have a nice weekend!

Marco

Hi Marco,

I guess you have to set a width for the side pane even if you don’t want to show it.

Please try something like

main_window.setPaneDimensions(sidepane, new int [] {0, 0, 1, 1 });

in unsetPaneDimension method.

Regards,

Stefan Veit

Thanks Stefan,

I’ve already tried that already successfully, but That would mean that the panes will overlap, right? Will there be still one pixel of that pane visible?

Hi Marco,

My apoIogies - I just remembered the panes need to have positive non-zero dimensions. You can set the pane off-screen though, so something like new int [] {-1000, 0, width, height } should work.

Regards,

Nick.

Hi Nick,

I’ve used new int [] {-1000, 0, 1, 1 } with phoney without any issue. Under iOS I get an Illegal Argument exception using negative values.

I’ve changed back to new int [] {0, 0, 1, 1 } and I cannot see any overlapping etc. at the display.

Regards

Marco