2014-09-23 28 views
0

使用UITest on git我正在構建一個UI。然而彈出對話框沒有顯示,至少我認爲它是一個彈出式對話窗口。在這裏,我設置的按鈕應該打開它:我的對話框不顯示

ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class)); 
    style.imageUp = new TextureRegionDrawable(image); 
    style.imageDown = new TextureRegionDrawable(imageFlipped); 
    ImageButton iconButton = new ImageButton(style); 

這裏是連接到它的監聽器:

iconButton.addListener(new ChangeListener() 
    { 
     public void changed (ChangeEvent event, Actor actor) 
     { 
      new Dialog("Some Dialog", skin, "dialog") 
      { 
       protected void result (Object object) 
       { 
        System.out.println("Chosen: " + object); 
       } 
      }.text("Are you enjoying this demo?").button("Yes", true).button("No", false).key(Keys.ENTER, true) 
       .key(Keys.ESCAPE, false).show(stage); 
     } 
    }); 

按鈕本身是否工作正常,當我點擊並按住它翻轉,但是當我釋放該對話框停止運行(可能是因爲其他對話需要注意)。我可以按enter/ESC鍵並在控制檯中獲得相應的結果(選擇:true/Chosen:false)。但是我無法退出,因爲我無法看到實際的對話框。

我沒有使用密碼框和下拉菜單等git example中的所有內容。我也將它作爲一個獨立的類來實現,並將它創建爲根類中的一個對象。我沒有看到這個問題,但是再次,我知道什麼:)?

回答

0

發現了問題,不能修復的問題是目前中指出:

//I had this in my render method: 
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1/30)); 
//Should be 
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1/30f)); 
//Otherwise it would always be 0, and i guess that would pause the whole stage.