Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to fit a Scale in a ToolBar properly
How to fit a Scale in a ToolBar properly [message #180938] Wed, 11 May 2005 16:23 Go to next message
Eclipse UserFriend
Originally posted by: florin_florea.hotmail.com

I have aViewPart and want to use a "org.eclipse.swt.widgets.Scale" to zoom a
Figure inside the view.
For that matter I created the method below:

private void createToolBar() {
IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
IContributionItem control = new ControlContribution("Scale") {
public Control createControl(Composite parent) {
Scale scale = new Scale (parent, SWT.HORIZONTAL);
scale.setMinimum(1);
scale.setMaximum(19);
scale.setSelection(10);
scale.setPageIncrement(3);
scale.setIncrement(1);
scale.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
int sel = ((Scale)e.getSource()).getSelection();

((ScalableFreeformLayeredPane)view).setScale((double)sel/10) ;
}

public void widgetDefaultSelected(SelectionEvent e) {}
});
return scale;
}

public int computeWidth(Control control) {
return control.computeSize(100, SWT.DEFAULT, true).x;
}
};
mgr.add(control);
mgr.add(new Separator());
}

The problem: the Scale height is larger than the ToolBar height. How can I
make the Scale fit inside the ToolBar's borders?

I tried different approaches (including setLayoutData(new GridData()) and so
forth) but didn't help.

Thanks,

F
Re: How to fit a Scale in a ToolBar properly [message #181037 is a reply to message #180938] Wed, 11 May 2005 23:35 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
org.eclipse.swt.widgets.Scale
There's no GEF or Draw2d in there.
Wrong newsgroup.

"Florin" <florin_florea@hotmail.com> wrote in message
news:d5tc27$o73$1@news.eclipse.org...
> I have aViewPart and want to use a "org.eclipse.swt.widgets.Scale" to zoom
a
> Figure inside the view.
> For that matter I created the method below:
>
> private void createToolBar() {
> IToolBarManager mgr =
getViewSite().getActionBars().getToolBarManager();
> IContributionItem control = new ControlContribution("Scale") {
> public Control createControl(Composite parent) {
> Scale scale = new Scale (parent, SWT.HORIZONTAL);
> scale.setMinimum(1);
> scale.setMaximum(19);
> scale.setSelection(10);
> scale.setPageIncrement(3);
> scale.setIncrement(1);
> scale.addSelectionListener(new SelectionListener() {
> public void widgetSelected(SelectionEvent e) {
> int sel = ((Scale)e.getSource()).getSelection();
>
> ((ScalableFreeformLayeredPane)view).setScale((double)sel/10) ;
> }
>
> public void widgetDefaultSelected(SelectionEvent e) {}
> });
> return scale;
> }
>
> public int computeWidth(Control control) {
> return control.computeSize(100, SWT.DEFAULT, true).x;
> }
> };
> mgr.add(control);
> mgr.add(new Separator());
> }
>
> The problem: the Scale height is larger than the ToolBar height. How can I
> make the Scale fit inside the ToolBar's borders?
>
> I tried different approaches (including setLayoutData(new GridData()) and
so
> forth) but didn't help.
>
> Thanks,
>
> F
>
>
Previous Topic:JDT sub-menu in my diagram's context menu !!!
Next Topic:Bendpoint problem again
Goto Forum:
  


Current Time: Mon Sep 23 21:29:14 GMT 2024

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

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

Back to the top