2014-04-02 18 views
0

` 我有GWT的DialogBox,將打開,一旦我點擊按鈕。鼠標滾動只在打開的對話框上工作,我想讓它也適用於父窗口。 我試圖通過使模態=「假」,但沒有用。請幫忙。如何啓用g的父窗口滾動:DialogBox

這裏是示例代碼

<g:DialogBox autoHide="false" glassEnabled="true" modal="true" styleName="{style.historyGraphDialogPanel}"> 
    <g:HTMLPanel > 
     <table class="HistoryGraphInteractionTable" ui:field="historyGraphInteractionTable"> 
     <tbody> 
     <tr> 
     <td> 
      <g:Button ui:field="lastDay">Last Day</g:Button> 
      <g:Button ui:field="lastWeek">Last Week</g:Button> 
      <g:Button ui:field="lastMonth">Last Month</g:Button> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <cdm:HistoryGraphWidget ui:field="graphWidget" /> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <g:Button ui:field="closeButton">Close</g:Button> 
     </td> 
     </tr> 
    </tbody> 
    </table> 
</g:HTMLPanel> 

.historyGraphDialogPanel { 
    background-color: ivory;   
}` 

回答

0

我不知道爲什麼modal屬性不是ui.xml工作,但在JAVA設置模式將解決你的問題。

setModal(false); 

下面是一個示例代碼:

MyDialogbox.java:

import com.google.gwt.core.client.GWT; 
import com.google.gwt.event.dom.client.ClickEvent; 
import com.google.gwt.uibinder.client.UiBinder; 
import com.google.gwt.uibinder.client.UiField; 
import com.google.gwt.uibinder.client.UiHandler; 
import com.google.gwt.uibinder.client.UiTemplate; 
import com.google.gwt.user.client.ui.Button; 
import com.google.gwt.user.client.ui.DialogBox; 
import com.google.gwt.user.client.ui.Widget; 

public class MyDialogbox extends DialogBox { 

    private static MyUiBinder myUIBinder = GWT.create(MyUiBinder.class); 

    @UiTemplate("MyDialogbox.ui.xml") 
    interface MyUiBinder extends UiBinder<Widget, MyDialogbox> { 
    } 

    public MyDialogbox() { 
     setWidget(myUIBinder.createAndBindUi(this)); 
     this.setModal(false); 
    } 

    @UiField 
    Button cancelButton; 

    @UiHandler("cancelButton") 
    void hideDialogBox(ClickEvent event) { 
     hide(); 
    } 

} 

MyDialogbox.ui.xml:

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' 
    xmlns:g='urn:import:com.google.gwt.user.client.ui'> 

    <g:DialogBox autoHide="true" modal="false"> 
     <g:caption> 
      <b>Caption text</b> 
     </g:caption> 
     <g:HTMLPanel> 
      Body text 
      <g:Button ui:field='cancelButton'>Cancel</g:Button> 
      <g:Button ui:field='okButton'>Okay</g:Button> 
     </g:HTMLPanel> 
    </g:DialogBox> 
</ui:UiBinder>