在对话框中选择<纸张选项卡>时调整<纸张对话框>的大小

时间:2015-05-03 00:46:23

标签: dart polymer paper-elements

resizeable_dialog.html

Set WshShell = CreateObject("WScript.Shell")    
WshShell.Run chr(34) & "C:\file.bat" & Chr(34), 0    
Set WshShell = Nothing    

resizeable_dialog.dart

<link rel="import" href="../../packages/polymer/polymer.html">

<link rel="import" href="../../packages/paper_elements/paper_dialog.html">
<link rel="import" href="../../packages/paper_elements/paper_button.html">
<link rel="import" href="../../packages/paper_elements/paper_tabs.html">
<link rel="import" href="../../packages/paper_elements/paper_tab.html">
<link rel="import" href="../../packages/paper_elements/paper_icon_button.html">
<link rel="import" href="../../packages/core_elements/core_toolbar.html">
<link rel="import" href="../../packages/core_elements/core_pages.html">

<polymer-element name="resizeable-dialog">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <paper-button on-click="{{open}}">Open Dialog</paper-button>    
    <paper-dialog id="dialog" transition="core-transition-bottom" backdrop>
      <paper-tabs selected="{{selected}}">
        <paper-tab>Page 1</paper-tab>
        <paper-tab>Page 2</paper-tab>
      </paper-tabs>
      <section>
        <core-pages selected="{{selected}}">
          <div style="width: 100px; height: 100px;">
            <div>Page 1: 100x100</div>
            <paper-button on-click="{{notifyResize}}">Call 'notifyResize'</paper-button>          
          </div>
          <div style="width: 400px; height: 400px;">
            <div>Page 2: 400x400</div>
            <paper-button on-click="{{notifyResize}}">Call 'notifyResize'</paper-button>          
          </div>
        </core-pages>
      </section>
    </paper-dialog>

  </template>
  <script type="application/dart" src="resizeable_dialog.dart"></script>
</polymer-element>

这是我的对话框,我想你可以通过tabbar获得这个想法。我的问题是library resizable_dialog; import 'package:polymer/polymer.dart'; import 'package:paper_elements/paper_dialog.dart'; @CustomTag('resizeable-dialog') class ResizeableDialog extends PolymerElement { ResizeableDialog.created() : super.created(); @observable int selected = 0; notifyResize() { $['dialog'] as PaperDialog..notifyResize(); print('"notifyResize" called.'); } open() { $['dialog'] as PaperDialog..open(); } } 在显示之前的某个时刻计算其尺寸。但是,由于我的<paper-dialog>可以有不同的宽度和宽度。高度,每当用户选择一个标签时,我必须调整对话框的大小,以确保当前所选页面的整个内容可见。

由于某些原因,Dart中不存在方法<core-pages>。它在<paper-dialog>.notifyResize()文档中指定了here但我无法调用它,因为它在Dart中不存在。

我该怎么做?如何让对话框重新测量其尺寸?

0 个答案:

没有答案