Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » First ToolItem has raised border in SWT standalone app
First ToolItem has raised border in SWT standalone app [message #460084] Mon, 22 August 2005 06:20 Go to next message
Eclipse User
Originally posted by: thorsten.dithosoft.de

Hi,

I'm currently teaching myself how to use SWT in standalone applications.
I'm creating a flat toolbar on a coolbar and I have the problem that the
first button has a raised border when the application starts as if the
mouse was over it, even though it isn't.

The code is as follows:

private void initializeToolbar() {
CoolBar coolBar = new CoolBar(m_shell,SWT.FLAT);
coolBar.setLayoutData(new GridData(...));

m_toolBar = new ToolBar(coolBar,SWT.HORIZONTAL | SWT.FLAT | SWT.WRAP);
m_toolBarNew = createToolItem(m_toolBar,SWT.PUSH,m_imageNew,"New");
m_toolBarOpen = createToolItem(m_toolBar,SWT.PUSH,m_imageOpen,"Open");

...

CoolItem item1 = new CoolItem(coolBar,SWT.NONE);
item1.setControl(m_toolBar);
...
}

ToolItem createToolItem(ToolBar parent, int style, Image image, String
toolTip) {
ToolItem item = new ToolItem(parent,style);
item.setImage(image);
item.setToolTipText(toolTip);
return item;
}

How do I fix this?

Thanks
Thorsten
Re: First ToolItem has raised border in SWT standalone app [message #460088 is a reply to message #460084] Mon, 22 August 2005 06:53 Go to previous messageGo to next message
Boris Munivrana is currently offline Boris Munivrana
Messages: 23
Registered: July 2009
Junior Member
Hi Thorsten,

just set the focus onto another control after initializing your toolbar.

Regards,

Boris

Thorsten Dittmar wrote:

> Hi,

> I'm currently teaching myself how to use SWT in standalone applications.
> I'm creating a flat toolbar on a coolbar and I have the problem that the
> first button has a raised border when the application starts as if the
> mouse was over it, even though it isn't.

> The code is as follows:

> private void initializeToolbar() {
> CoolBar coolBar = new CoolBar(m_shell,SWT.FLAT);
> coolBar.setLayoutData(new GridData(...));

> m_toolBar = new ToolBar(coolBar,SWT.HORIZONTAL | SWT.FLAT | SWT.WRAP);
> m_toolBarNew = createToolItem(m_toolBar,SWT.PUSH,m_imageNew,"New");
> m_toolBarOpen = createToolItem(m_toolBar,SWT.PUSH,m_imageOpen,"Open");

> ...

> CoolItem item1 = new CoolItem(coolBar,SWT.NONE);
> item1.setControl(m_toolBar);
> ...
> }

> ToolItem createToolItem(ToolBar parent, int style, Image image, String
> toolTip) {
> ToolItem item = new ToolItem(parent,style);
> item.setImage(image);
> item.setToolTipText(toolTip);
> return item;
> }

> How do I fix this?

> Thanks
> Thorsten
Re: First ToolItem has raised border in SWT standalone app [message #460092 is a reply to message #460088] Mon, 22 August 2005 07:22 Go to previous message
Eclipse User
Originally posted by: thorsten.dithosoft.de

Hi Boris,

oops - now I look like a fool... :-o Should have thought of that :-)
Thanks for the hint!

Thorsten

> Hi Thorsten,
>
> just set the focus onto another control after initializing your toolbar.
>
> Regards,
>
> Boris
Previous Topic:IllegalArgumentException for own Listener class
Next Topic:setInitialSelections in ElementListSelectionDialog does not work
Goto Forum:
  


Current Time: Sun Aug 31 00:42:34 EDT 2014

Powered by FUDForum. Page generated in 0.07643 seconds