23.04.2016, 01:49
Hi, I have a problem with onCancel and onShow in common dialogs.
Consider the following code:
Then you get:
- dialog showed
* player clicks ok *
- dialog showed
- dialog hided
But should be:
- dialog showed
* player clicks anything *
- dialog hided
- dialog showed
My problem, specifically, is that I show some TDs inside onShow (and hide them when closed), so
when I "reshow" the dialog, textdraws are hided but not showed again.
Seeing the code, I think that the problem is on AbstractDialog.java, when you handle the response, onClose(CloseType.RESPONSE) should be called BEFORE onClickOk.
Consider the following code:
Код:
ListDialog.create()
.item("asd")
.onClickOk((thisDialog) -> {
player.sendMessage("reshowing the dialog");
thisDialog.show();
})
.onShow((thisDialog) -> {
player.sendMessage("dialog showed");
})
.onClose((thisDialog) -> {
player.sendMessage("dialog hided");
})
.build()
.show(player);
- dialog showed
* player clicks ok *
- dialog showed
- dialog hided
But should be:
- dialog showed
* player clicks anything *
- dialog hided
- dialog showed
My problem, specifically, is that I show some TDs inside onShow (and hide them when closed), so
when I "reshow" the dialog, textdraws are hided but not showed again.
Seeing the code, I think that the problem is on AbstractDialog.java, when you handle the response, onClose(CloseType.RESPONSE) should be called BEFORE onClickOk.

