Author |
Message |
08/09/2012 13:40:58
|
bthalheim
Power User
Joined: 05/04/2012 11:45:24
Messages: 72
Offline
|
Hi,
I use few Modal and Modeless Popup where I need to pass width and height into. No problem, I pick some values and they look well on my screen. Using 0,0 for automatic popup sizing is not possible at any time, so I need to stick to this static size definition.
I'm afraid that what works on my screen could look bad on other monitors (Maybe because they're bigger and the Popup looks very small or vice versa).
So my Idea is: If I know the width and height of the client screen then I could implement something adaptive for that screen, e.g. that a Popup opens at 1/3 of the screen height and 2/3 of screen width).
In Code it would look like this:
Code:
popup.open(
popupUi.getPageName(),
this.messageSource.getMessage("popup_headline", getLocale()),
(getScreenWidth()*2)/3,
(getScreenHeight())/3,
new DefaultModalPopupListener(popup)
);
Spontaniously, I have no idea how I would implement getScreenWidth() and getScreenHeight(). Any hints how this can be accomplished, are welcome.
Thanks,
Björn
|
|
|
09/09/2012 08:07:55
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5555
Offline
|
Hi,
within a PANE you may arrange a SIZETRANSFER component.This always passes the current size of the PANE to the server.
(Example: Demo Workplace, Container, Transfer of actual Size)
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
13/09/2012 10:49:01
|
bthalheim
Power User
Joined: 05/04/2012 11:45:24
Messages: 72
Offline
|
OK, cool. Thanks.
This works. Even better would bei a possibility to obtain the _screen_ size, because even the outmost CaptainCasa pane is way smaller than the screen (especially in a PageBrowser scenario).
But getting the real screen size is not possible, I presume?
Cheers,
Björn
|
|
|
23/04/2014 18:03:00
|
phuber
Power User
Joined: 06/08/2010 14:10:58
Messages: 50
Offline
|
A quick and dirty solution could be ...
There exists a SCREEN GRABBER component (see Demo Workplace -> Screen Grabber).
Take a full screenshot. Use some code to get the width and heigth as shown below ...
Code:
public void onReceiveGrabbedArea(ActionEvent event)
{
if (event instanceof BaseActionEventSendImage)
{
try
{
BufferedImage image = ImageIO.read(new ByteArrayInputStream(
((BaseActionEventSendImage) event).getImageBytes()));
m_hgt = image.getHeight();
m_wdt = image.getWidth();
}
catch (IOException e1)
{
System.err.println(e1.getMessage());
}
}
}
|
|
|
|