Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Native Close Button
Native Close Button [message #447079] Wed, 08 December 2004 15:25 Go to next message
Eclipse UserFriend
Originally posted by: dobrikov.rbg.informatik.tu-darmstadt.de

Hello,
I want to ask if it is possible to use the standard native "close button",
which is implemented in the Shell widget. I want to use this native "close
button" in a normal composite and not to use the shell at all...
I can always create my custom "close button", but then I will have the
problem to use it under PocketPC, because of the bug with the
image-buttons on PocketPC.
Regards,
Todor
Re: Native Close Button [message #447120 is a reply to message #447079] Wed, 08 December 2004 21:28 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">There really isn't any way to do this.  You'll have
to dip into the native through JNI if you really need this function. 
Either that, or emulate it.<br>
<br>
Daniel<br>
</font><br>
Todor Dobrikov wrote:
<blockquote cite="midcp76dh$ndt$1@www.eclipse.org" type="cite">Hello,
<br>
I want to ask if it is possible to use the standard native "close
button", which is implemented in the Shell widget. I want to use this
native "close button" in a normal composite and not to use the shell at
all... I can always create my custom "close button", but then I will
have the problem to use it under PocketPC, because of the bug with the
image-buttons on PocketPC.
<br>
Regards,
<br>
Todor
<br>
<br>
</blockquote>
</body>
</html>
Re: Native Close Button [message #447158 is a reply to message #447120] Thu, 09 December 2004 09:57 Go to previous messageGo to next message
Todor is currently offline TodorFriend
Messages: 2
Registered: July 2009
Junior Member
I was almost sure that it will be like this...but I thought that maybe
there will be such a way, because there are such a close buttons on each
tab(on TabPane for example when you open files, next to the file name) in
eclispe...Emulating is ok but I am building a GUI for PocketPC...and there
the image buttons are not working...

Todor


Daniel Spiewak wrote:

> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-15"
> http-equiv="Content-Type">
> <title></title>
> </head>
> <body bgcolor="#ffffff" text="#000000">
> <font face="serif">There really isn't any way to do this. You'll have
> to dip into the native through JNI if you really need this function.
> Either that, or emulate it.<br>
> <br>
> Daniel<br>
> </font><br>
> Todor Dobrikov wrote:
> <blockquote cite="midcp76dh$ndt$1@www.eclipse.org" type="cite">Hello,
> <br>
> I want to ask if it is possible to use the standard native "close
> button", which is implemented in the Shell widget. I want to use this
> native "close button" in a normal composite and not to use the shell at
> all... I can always create my custom "close button", but then I will
> have the problem to use it under PocketPC, because of the bug with the
> image-buttons on PocketPC.
> <br>
> Regards,
> <br>
> Todor
> <br>
> <br>
> </blockquote>
> </body>
> </html>
Re: Native Close Button [message #447207 is a reply to message #447158] Thu, 09 December 2004 15:15 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
>I want to use this native "close button" in a normal composite
Just wondering. Isnt'it going to look 'non Pocket PC' and consume extra
space in that small PDA screen? Word on Pocket PC simply shows one document
at a time that can be closed with the child shell 'Ok' button.

> there the image buttons are not working...
On the Pocket PC, you can use a Label with an Image and register a mouse
listener to detect when the label was clicked.

And while we are on the topic, it's possible to set top menu items with the
PUSH style that display a 16x16 icon inside the menubar - as many Pocket PC
apps do.

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;

public class PR {

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Menu bar = new Menu (shell, SWT.BAR);
Image image = new Image(display, 16, 16); // put your real image here
shell.setMenuBar (bar);
MenuItem item = new MenuItem (bar, SWT.PUSH);
item.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event e) {
System.out.println ("Pushed!");
}
});
item.setImage(image);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
image.dispose();
display.dispose ();
}

}

Chris
Re: Native Close Button [message #447211 is a reply to message #447079] Thu, 09 December 2004 15:48 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
The close button belongs to the Window Manager on X platforms. There's no
way to know how it is rendered.

"Todor Dobrikov" <dobrikov@rbg.informatik.tu-darmstadt.de> wrote in message
news:cp76dh$ndt$1@www.eclipse.org...
> Hello,
> I want to ask if it is possible to use the standard native "close button",
> which is implemented in the Shell widget. I want to use this native "close
> button" in a normal composite and not to use the shell at all...
> I can always create my custom "close button", but then I will have the
> problem to use it under PocketPC, because of the bug with the
> image-buttons on PocketPC.
> Regards,
> Todor
>
Previous Topic:Menu not showing, even though isVisible() says true
Next Topic:vertical sliding tabs
Goto Forum:
  


Current Time: Fri Apr 26 00:58:52 GMT 2024

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

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

Back to the top