Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Image Button on Pocket PC
Image Button on Pocket PC [message #441627] Tue, 17 August 2004 21:37 Go to next message
No real name is currently offline No real nameFriend
Messages: 21
Registered: July 2009
Junior Member
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 #441643 is a reply to message #441627] Wed, 18 August 2004 13:48 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Hi Tobi,

Pocket PC does not support buttons with images. 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. Let us know if you need
more help with this.

Chris
Re: Image Button on Pocket PC [message #441667 is a reply to message #441643] Thu, 19 August 2004 13:15 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 21
Registered: July 2009
Junior Member
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
Re: Image Button on Pocket PC [message #442529 is a reply to message #441667] Tue, 07 September 2004 14:57 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
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
>
>
>
>
Previous Topic:Right-Click menu doesn't work on a disabled control
Next Topic:multiple top-level shells
Goto Forum:
  


Current Time: Fri Apr 19 22:15:40 GMT 2024

Powered by FUDForum. Page generated in 0.03440 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top