Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to resize a MessageDialog subclass and still see the button Bar
How to resize a MessageDialog subclass and still see the button Bar [message #463105] Wed, 26 October 2005 15:07 Go to next message
Eclipse UserFriend
Originally posted by: rbadette.oerlikon.ca

Hi guys,

I have gone though the threads and did not find an answer to my question.

I have a class that extends MessaDialog and i overrided intialSize as such :

protected Point getInitialSize(){return new
Point(IHM_DIALOG_WIDTH,IHM_DIALOG_HEIGHT);}

The Dialog has the new size but i can't see the Buttons {OK,CANCEL} i have
tried different combinations
by overriding:
protected Control createDialogArea(Composite parent)

and no Luck either i can see the Buttons and not the Icon associated with
the message type or i can't see the Buttons.

Anybody?
Re: How to resize a MessageDialog subclass and still see the button Bar [message #463112 is a reply to message #463105] Wed, 26 October 2005 17:30 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
To start with, you really don't want to subclass MessageBox. MessageBox is a widget which (like the other dialogs) mirrors directly down to a 1-1 native peer. Your subclass will (and is) *very* platform specific.

However, if you really know what you're doing (i.e. you're familiar with how the native widget works and how to use it), you can get away with your subclass. But you'll have to handle the native peering and calling the methods if you want to change the behavior. I honestly wouldn't know how to do that on any platform.

Out of curiosity, why would you want to manually resize a native dialog anyway?
Re: How to resize a MessageDialog subclass and still see the button Bar [message #463113 is a reply to message #463112] Wed, 26 October 2005 18:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rbadette.oerlikon.ca

Hey Daniel,

Thanks for taking the time...

The reason is that i am working on a portable device that has unusual
screen size so i wanted to use MessageDialog and resize it to fit the screen
real estate and i didn't want to re-write an other class that mimic tha same
functionality. But with your info i ma guessing that i won't have the choice
but to create my own implementation.

So can i subClass Dialog or any other class to ease-up the process ?


"Daniel Spiewak" <djspiewak@gmail.com> wrote in message
news:27004025.1130347889724.JavaMail.root@cp1.javalobby.org...
> To start with, you really don't want to subclass MessageBox. MessageBox
is a widget which (like the other dialogs) mirrors directly down to a 1-1
native peer. Your subclass will (and is) *very* platform specific.
>
> However, if you really know what you're doing (i.e. you're familiar with
how the native widget works and how to use it), you can get away with your
subclass. But you'll have to handle the native peering and calling the
methods if you want to change the behavior. I honestly wouldn't know how to
do that on any platform.
>
> Out of curiosity, why would you want to manually resize a native dialog
anyway?
Re: How to resize a MessageDialog subclass and still see the button Bar [message #463114 is a reply to message #463113] Wed, 26 October 2005 19:50 Go to previous message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
Dialog is an extensible class and it works great. I generally prefer to extend Composite, then create a Shell in the constructor and thus manually tune the Shell parameters so that it becomes a dialog. Dialog is just a wrapper class around a few Composite(s) and a Shell. Try SWT.DIALOG_TRIM and parenting Shell(s) on other Shell(s). It's fairly simple to simulate any number of the MessageBox styles. Remember, you can use the Display#getSystemImage(int) method along with one of the SWT.ICON_* styles to get the various system images (Warning, Error, Information, etc). Though, be forewarned that you should use a Canvas to render the image and not a Label. A Label will either create a black background for the image, or the image will be very pixelated. Anyway, good luck.
Previous Topic:List or ListViewer showing images?
Next Topic:How to add content assist in a form-based editor's Text widget?
Goto Forum:
  


Current Time: Thu Apr 25 09:51:53 GMT 2024

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

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

Back to the top