• Advertisement
Sign in to follow this  

Libgdx: How to leave the dialog visible?

This topic is 437 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

    setBtn.addListener(new ClickListener() {
        @Override
    
        public void clicked(InputEvent event, float x, float y) {
            final Dialog dialog = new Dialog("Settings", skin, "dialog") {
                public void result(Object obj) {
                    Preferences prefs = Gdx.app.getPreferences("My Preferences");
    
                    if (obj.equals(2))
                        muteMusic = true;
                    if (obj.equals(3))
                        muteMusic = false;
    
                    prefs.putBoolean("music", muteMusic);
                    prefs.flush();
    
    
                }
    
    
            };
            dialog.text("Do you want to play music");
            dialog.button("Yes", 2); //sends "true" as the result
            dialog.button("No", 3); //sends "false" as the result
            dialog.button("Ok", false);
    
            dialog.show(stage);
        }
    
    });
 
  • I want the ok button to be on an another row but if I do `dialog.row()` like with tables, it won't work, I can't add an empty row
  • I want the dialog to stay visible on the screen until the ok button is touched, only then I want to call `dialog.hide()`
  
I can't do
 
    if (obj.equals(false))
    dialog.hide(); // IDE will suggest that i create a local variable called dialog
 
 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement