工具栏在E4中无法正确缩放 [英] Toolbar does not scale correctly in E4

查看:78
本文介绍了工具栏在E4中无法正确缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些自定义工具栏小部件的E4应用程序。当应用程序在没有DPI缩放的情况下以Windows 10运行时,一切看起来都很好。更改DPI设置后,无法完全查看应用程序工具栏。



正确的视图:





启用缩放功能>



application.e4xmi看起来像:



负责创建窗口小部件的类如下:

 公共类OpenOrderDropDown {

@Inject
私有IEclipseContext上下文;

私人组合组合;

private static final String [] ITEMS = {默认,计划,打开JobOrders,库存单位,预定}};

@ PostConstruct
public void createControls(最终复合父级){

RowLayout layout = new RowLayout();
parent.setLayout(layout);

标签标签=新标签(父级,SWT.LEFT);
label.setText( View:);

combo = new Combo(parent,SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setItems(ITEMS);

combo.select(0);

combo.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e){

IEventBroker eventBroker = context.get( IEventBroker.class);
eventBroker.post( openOrdersView,combo.getText());

}
});
}

@注入
@可选
public void changeSelection(@UIEventTopic( changeOpenOrdersView)字符串选择){
if(selection == null || selection.isEmpty()){
selection =默认;
}

if(combo!= null&&!combo.isDisposed()){
combo.select(combo.indexOf(selection));
}

}

}

是否可以通过某种方式更改工具栏中小部件的高度?我知道如何计算DPI更改,但是无法在任何组件上设置任何heigt / width值。

解决方案

移动ToolControl项位于工具栏之外。工具栏内的控件不会调整条形的大小,但是当它们在工具栏外时,可以调整TrimBar的大小。


I have a E4 application with some custom toolbar widgets. When the application ran in WIndows 10 without DPI scaling, everything looks fine. After chaning the DPI settings the application toolbar is not fully viewed.

Correct view:

With scaling enabled:

The application.e4xmi looks like:

The class that is responsible for creating the widget looks like:

public class OpenOrderDropDown {

  @Inject
  private IEclipseContext context;

  private Combo combo;

  private static final String[] ITEMS = {"Default", "Planning", "Open JobOrders", "Stock Units", "To Schedule"};

  @PostConstruct
  public void createControls(final Composite parent) {

    RowLayout layout = new RowLayout();
    parent.setLayout(layout);

    Label label = new Label(parent, SWT.LEFT);
    label.setText("View: ");

    combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setItems(ITEMS);

    combo.select(0);

    combo.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {

        IEventBroker eventBroker = context.get(IEventBroker.class);
        eventBroker.post("openOrdersView", combo.getText());

      }
    });
  }

  @Inject
  @Optional
  public void changeSelection(@UIEventTopic("changeOpenOrdersView") String selection) {
    if (selection == null || selection.isEmpty()) {
      selection = "Default";
    }

    if (combo != null && !combo.isDisposed()) {
      combo.select(combo.indexOf(selection));
    }

  }

}

Is there some way to change the heigt of the widgets in the toolbar? I know how to calculate the DPI change but cannot set any heigt/width values on any of the components.

解决方案

Move the ToolControl items to be outside of the ToolBar. Controls inside a ToolBar don't resize the bar but when outside of the ToolBar they should resize the TrimBar ok.

这篇关于工具栏在E4中无法正确缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆