[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Shell location problem
|
And don't forget the very useful methods "toControl(x, y)" and "toDisplay(x,
y)" which convert x/y locations to display or control coordinates.
Emil
"Grant Gayed" <grant_gayed@xxxxxxxxxx> wrote in message
news:g13t32$o09$1@xxxxxxxxxxxxxxxxxxxx
>I don't know what a PlotRenderingDialog is, but for swt Shells one or more
> of the following are helpful for cases like this:
>
> - Shell.pack() makes a Shell lay out its widgets to their optimal sizes
> (so
> no need to specify dimensions)
> - Shell.setLocation() sets its location without specifying its dimensions
> - Shell.computeSize(SWT.DEFAULT, SWT.DEFAULT) asks a Shell to return its
> optimal dimensions based on its content
>
> If none of these helps your case then PlotRenderingDialog may be lacking
> some API or functionality to do what you want.
>
> Grant
>
>
> "josandres" <j.andres.pizarro@xxxxxxxxx> wrote in message
> news:035ee0ef17491aa203497bd62bfa848a$1@xxxxxxxxxxxxxxxxxx
>> I'm trying to show a dialog at a specific location with the following
>> code. Notice that i'm making dialog visible when a mouse event is
>> captured
>> by a Swing component.
>>
>> public void mouseClicked(MouseEvent e) {
>> [...]
>> else if ((e.getButton() == MouseEvent.BUTTON3) && (e.getClickCount() ==
>> 1)) { Display.getDefault().asyncExec(new Runnable () {
>> public void run() {
>> Shell shell = new Shell(SWT.ON_TOP);
>> shell.setLocation(50,50);
>> PlotRenderingDialog dialog = PlotRenderingDialog.getInstance(m_trace,
>> new Shell(SWT.ON_TOP));
>> dialog.open();
>> }
>> });
>> }
>> [...]
>> }
>>
>> The problem is that dialog appears in a random location, i mean, every
>> time it appears it does in a different location.
>>
>> If i use method setBounds(50, 50, width, height) it is positioned
>> correctly but, i don't know the dialog size!
>>
>> Any answers?
>>
>
>