Image Button on Pocket PC [message #441627] |
Tue, 17 August 2004 17:37  |
Eclipse User |
|
|
|
Hello,
I wrote this code:
InputStream inputStreamButton =
this.getClass().getResourceAsStream("Search16.gif");
Image imageButton = new Image(display, inputStreamButton);
Button buttonFile = new Button(compositeFile, SWT.NONE);
buttonFile.setImage(imageButton);
This works fine on normal windows but on Pocket PC is only a blank button
without image.
Is this a bug and if so, exist there are a workareound?
The button should open the filedialog.
Regards, Tobi
|
|
|
|
|
Re: Image Button on Pocket PC [message #442529 is a reply to message #441667] |
Tue, 07 September 2004 10:57  |
Eclipse User |
|
|
|
Yes. It's a native limitation.
"Tobi Wink" <tobi.winkesf@lycos.com> wrote in message
news:cg2arm$3vl$1@eclipse.org...
> Hello,
>
> Thank you for your answer!
> > Pocket PC does not support buttons with images.
> Is this generally so also for native c applications?
>
> > Instead, you can use a
> > Label widget and hook mouse events (MouseDown/MouseUp) to open your
> > Dialog. Images work for Labels on the Pocket PC.
> I had this idea after reading the article "Writing your own widget".
> But this is maybe a common question and good to add in the "Snippets for
> Pocket PC" section?
>
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform -swt-home/dev.html#pocketsnippets.
>
> I use this code now:
> Label label = new Label(composite, SWT.NONE);
> label.setImage(image);
> label.addMouseListener(new MouseAdapter() {
> public void mouseDown(MouseEvent event)
> {
> if (event.button == 1)
> {
> FileDialog dialog = new FileDialog(shell, SWT.OPEN);
> String filename = dialog.open();
> if (filename != null) textFile.setText(filename);
> }
> }
> });
>
> > Let us know if you need more help with this.
> Thank you for your offered help but I have it running now.
>
> Regards, Tobi
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.36205 seconds