PocketPC: size of Dialog [message #446750] |
Thu, 02 December 2004 05:57  |
Eclipse User |
|
|
|
I created a little drawing application on my pocket pc. If the menuitem
"new" is pressed I open a dialog with some drawing templates.
How can I set the size of this dialog to full screen like a dialog-based
application?
My dialog was displayed inside the drawing application. It does not matter
if the dialogs parent is my application-shell or null.
|
|
|
Re: PocketPC: size of Dialog [message #446802 is a reply to message #446750] |
Thu, 02 December 2004 10:14   |
Eclipse User |
|
|
|
Hi Stefan,
Try the code below. By default, the Shell is full size and Shell.setBounds
is rarely used on the Pocket PC (only for small dialogs that are not very
common).
Chris
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
public class PR {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("PR");
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
fileItem.setText ("File");
Menu submenu = new Menu (shell, SWT.DROP_DOWN);
fileItem.setMenu (submenu);
MenuItem item = new MenuItem (submenu, SWT.PUSH);
item.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event e) {
Shell dialog = new Shell(shell, SWT.CLOSE);
Menu bar = new Menu(dialog, SWT.BAR);
dialog.setMenuBar(bar);
dialog.setLayout(new FillLayout());
Label l = new Label(dialog, SWT.SIMPLE);
l.setText("I am in a new dialog");
dialog.open();
}
});
item.setText ("new");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
|
|
|
Re: PocketPC: size of Dialog [message #446827 is a reply to message #446802] |
Fri, 03 December 2004 04:18   |
Eclipse User |
|
|
|
Hi Chris,
I tried SWT.CLOSE before. But for all that your mail helped me. I review
SWT-styles.
Up to now I used
SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE
Now I use
SWT.CLOSE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE
because SWT.DIALOG_TRIM includes SWT.TITLE and this is the problem. Without
this style everything works fine.
Tanks
Stefan
"Christophe Cornu" <christophe_cornu@ca.ibm.com> schrieb im Newsbeitrag
news:conbgo$hst$1@www.eclipse.org...
> Hi Stefan,
>
> Try the code below. By default, the Shell is full size and Shell.setBounds
> is rarely used on the Pocket PC (only for small dialogs that are not very
> common).
>
> Chris
>
> import org.eclipse.swt.*;
> import org.eclipse.swt.widgets.*;
> import org.eclipse.swt.layout.*;
>
> public class PR {
>
> public static void main(String[] args) {
> Display display = new Display();
> final Shell shell = new Shell(display);
> shell.setText("PR");
> Menu bar = new Menu(shell, SWT.BAR);
> shell.setMenuBar(bar);
>
> MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
> fileItem.setText ("File");
> Menu submenu = new Menu (shell, SWT.DROP_DOWN);
> fileItem.setMenu (submenu);
> MenuItem item = new MenuItem (submenu, SWT.PUSH);
> item.addListener (SWT.Selection, new Listener () {
> public void handleEvent (Event e) {
> Shell dialog = new Shell(shell, SWT.CLOSE);
> Menu bar = new Menu(dialog, SWT.BAR);
> dialog.setMenuBar(bar);
> dialog.setLayout(new FillLayout());
> Label l = new Label(dialog, SWT.SIMPLE);
> l.setText("I am in a new dialog");
> dialog.open();
> }
> });
> item.setText ("new");
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> }
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04857 seconds