Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to put the toolbar text beside the image
How to put the toolbar text beside the image [message #457136] Fri, 17 June 2005 17:49 Go to next message
Eclipse UserFriend
Hi there,

I have a toolbar with buttons, some of which have text, all of which have
icons.
I would like the text to appear to the left of the image. By default the
text appears below the image.

Is there any way to do this in SWT?


Here's some sample code of how I'm building the toolbar:

ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT);

ToolItem button = new ToolItem (toolbar, SWT.NONE);
button.setText ("MyButton");
button.setToolTipText( "This is my button");
button.setImage (Images.getMyImage());

GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
toolbar.setLayoutData (gridData);

Thanks
Damian
Re: How to put the toolbar text beside the image [message #457165 is a reply to message #457136] Mon, 20 June 2005 09:48 Go to previous messageGo to next message
Eclipse UserFriend
The closest you can get is to have your text appear to the right of your
image. To do this create your ToolItems with style SWT.RIGHT.

Grant

"Damian" <damian_biollo@hotmail.com> wrote in message
news:d8vgho$t92$1@news.eclipse.org...
> Hi there,
>
> I have a toolbar with buttons, some of which have text, all of which have
> icons.
> I would like the text to appear to the left of the image. By default the
> text appears below the image.
>
> Is there any way to do this in SWT?
>
>
> Here's some sample code of how I'm building the toolbar:
>
> ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT);
>
> ToolItem button = new ToolItem (toolbar, SWT.NONE);
> button.setText ("MyButton");
> button.setToolTipText( "This is my button");
> button.setImage (Images.getMyImage());
>
> GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> toolbar.setLayoutData (gridData);
>
> Thanks
> Damian
>
>
Re: How to put the toolbar text beside the image [message #457196 is a reply to message #457165] Mon, 20 June 2005 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, SWT.RIGHT worked.

Although, it seemed to be needed in the constructor of the toolbar, rather
than the ToolItem constructor:
ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT |
SWT.RIGHT);


"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d96hfa$b83$1@news.eclipse.org...
> The closest you can get is to have your text appear to the right of your
> image. To do this create your ToolItems with style SWT.RIGHT.
>
> Grant
>
> "Damian" <damian_biollo@hotmail.com> wrote in message
> news:d8vgho$t92$1@news.eclipse.org...
> > Hi there,
> >
> > I have a toolbar with buttons, some of which have text, all of which
have
> > icons.
> > I would like the text to appear to the left of the image. By default the
> > text appears below the image.
> >
> > Is there any way to do this in SWT?
> >
> >
> > Here's some sample code of how I'm building the toolbar:
> >
> > ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL |
SWT.FLAT);
> >
> > ToolItem button = new ToolItem (toolbar, SWT.NONE);
> > button.setText ("MyButton");
> > button.setToolTipText( "This is my button");
> > button.setImage (Images.getMyImage());
> >
> > GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> > toolbar.setLayoutData (gridData);
> >
> > Thanks
> > Damian
> >
> >
>
>
Re: How to put the toolbar text beside the image [message #457204 is a reply to message #457196] Tue, 21 June 2005 09:28 Go to previous message
Eclipse UserFriend
Right, my mistake. It is applied to all items within a ToolBar, not
individual items.

"Damian" <damian_biollo@hotmail.com> wrote in message
news:d97ilo$kuk$1@news.eclipse.org...
> Thanks, SWT.RIGHT worked.
>
> Although, it seemed to be needed in the constructor of the toolbar, rather
> than the ToolItem constructor:
> ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL | SWT.FLAT |
> SWT.RIGHT);
>
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
> news:d96hfa$b83$1@news.eclipse.org...
> > The closest you can get is to have your text appear to the right of your
> > image. To do this create your ToolItems with style SWT.RIGHT.
> >
> > Grant
> >
> > "Damian" <damian_biollo@hotmail.com> wrote in message
> > news:d8vgho$t92$1@news.eclipse.org...
> > > Hi there,
> > >
> > > I have a toolbar with buttons, some of which have text, all of which
> have
> > > icons.
> > > I would like the text to appear to the left of the image. By default
the
> > > text appears below the image.
> > >
> > > Is there any way to do this in SWT?
> > >
> > >
> > > Here's some sample code of how I'm building the toolbar:
> > >
> > > ToolBar toolbar = new ToolBar (parent, SWT.HORIZONTAL |
> SWT.FLAT);
> > >
> > > ToolItem button = new ToolItem (toolbar, SWT.NONE);
> > > button.setText ("MyButton");
> > > button.setToolTipText( "This is my button");
> > > button.setImage (Images.getMyImage());
> > >
> > > GridData gridData = new GridData (GridData.FILL_HORIZONTAL);
> > > toolbar.setLayoutData (gridData);
> > >
> > > Thanks
> > > Damian
> > >
> > >
> >
> >
>
>
Previous Topic:Menu bar changes by OleFrame or OleClientSite
Next Topic:Writing inside one StyleRange and still using it
Goto Forum:
  


Current Time: Wed Jul 16 11:25:33 EDT 2025

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

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

Back to the top