cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any method to get the visible width of the browser frame?

Former Member
0 Kudos

Hi all,

does WD suppy a method where I can get the width of the visible area of the browser frame? Like the JavaScript property Window.innerWidth?

Best regards,

Christian

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Christian

I was just curious why you would want want to find the browser width . The width of UI elements also take in percentages by putting a % at the end of the value

Regards

Pran

Former Member
0 Kudos

Hi Pran,

we're using percentage width in the most cases. Actually we want to use it everywhere of cause.

But we have a very strange behaviour. When we use a scrollcontainer with percentual width and therein we have a table with a width eg. of approx. 4000px the width of the window gets 4000px!! This doesn't happen if the scrollcontainer has a fixed width.

Best regards,

Christian

Former Member
0 Kudos

Hello Pran,

Please post a sample code in which width of a window is defined in <b>percentage</b> ?

Regards,

Aayush

Former Member
0 Kudos

No.

1. There are no methods defined in public API

3. It is not implemented even in core classes (as of SP6 / SSR)

Sample code:


import com.sap.tc.webdynpro.services.session.IWindow;
import com.sap.tc.webdynpro.services.session.api.WDCssSize;

import com.sap.tc.webdynpro.services.task.TaskBinder;
...
  private static String val(final WDCssSize size)
  {
  	if ( WDCssSize.UNDEFINED.equals( size ) )
  		return "<null>";
  	else
  		return size.toString();
  }
  
  private void test()
  {
  	final IWindow wndMain = TaskBinder.getCurrentTask().getApplicationWindow(); 
	final WDCssSize top    = wndMain.getWindowPositionTop();
	final WDCssSize left   = wndMain.getWindowPositionLeft();
	final WDCssSize height = wndMain.getWindowHeight();
	final WDCssSize width  = wndMain.getWindowWidth();
	
	wdComponentAPI.getMessageManager().reportSuccess
	(
		"Rect: " +
		"x1 = " + val(left) + ", " + 
		"y1 = " + val(top)  + ", " +
		"w = " + val(width) + ", " +
		"h = " + val(height)
		
	);
  }

Embedd test() call in any component and you will see <b>null</b> both for <i>width(w)</i> and <i>height(h)</i>

Good luck

VS