I had to change the user experience of one form in my app because I
couldn't have both a TextArea and a BrowserComponent to have the "fill
parent" behaviour.
I decided to display the webview in an alert dialog.
The width of the webview has to be as large as the lesser dimension
of screen, that is passed as the width parameter, for example the skin I
am testing onto has 1534 (it is the height in landscape mode).
Also the height of the dialog is calculated to be as large as to display a
button and the webview.
But I get the tiny dialog that can be seen in the attached image.
How can this be fixed sticking with InteractionDialog?
Notice that the rectangle has right dimensions, as expected to be in the
user interface:
x = 983 y = 729 size = width = 1534 height = 104 (debug values)
but the dialog does not spread.
In the code below there are some utility methods that work seamlessly with
other dialogs, to set the correct appearance. Just this dialog is not
working.
Thanks in advance
public static void testWebViewAlertDialog( String s1, String s2,int width)
{
InteractionDialog alertDialog=new InteractionDialog(s1);
Button okButton=new Button(R.okCommand);
alertDialog.setLayout(BoxLayout.y());
Container c1=new Container();
c1.setLayout(BoxLayout.y());
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
alertDialog.dispose();
}
});
c1.setLayout(new BorderLayout());
BrowserComponent testWebView=new BrowserComponent();
testWebView.addWebEventListener("onLoad", new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("onload test");
c1.add(BorderLayout.SOUTH,okButton);
alertDialog.add(c1);
Rectangle rect = getRect(c1);
c1.add(BorderLayout.CENTER,testWebView);
if (width>rect.getWidth()) rect.setWidth(width);
rect.setHeight(rect.getHeight()+testWebView.getPreferredSize().getHeight());
alertDialog.showPopupDialog(rect);
}});
testWebView.setPage(s2,"");
}
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/d1f015bf-80ea-4d80-aace-2cf10f829eefn%40googlegroups.com.