On 29-05-2019 23:52, Alex X wrote:
[SKIP TO------>HERE]
There is no run:
Error: no property
run
for typegtk.Window.Window
(I'm using a window, trying with a real dialog)
Same problem. Shows up the first time but then corrupt the second(the window that pops up is smaller and just a gray rectangle with a square).
I feeling is that some how the popup handler is corrupting the window. I'm going to try to dispatch it... same issue.
dialog.run(); dialog.destroy(); dialog.run(); dialog.destroy(); dialog.run(); dialog.destroy();
does not work, unlike when I use a window and hide and show
For example, this works:
dialog.run(); dialog.showAll(); dialog.hide(); dialog.showAll(); dialog.hide(); dialog.showAll(); dialog.hide(); dialog.run(); dialog.run();
The showAll doesn't seem do do anything.
but running it 3 times requires me to close it 3 times... but it always shows up properly.
[------HERE]
What seems to be happening is something like this:
When closing out the window/dialog it destroys the window and it is not recovered(Remember, I'm using glade builder to generate the window).
If I do
dialog.run(); dialog.destroy();
dialog.run();
Then after the first close the window is screwed up on the next run
So it seems like the window is being destroyed and I'm trying to run a destroyed window/dialog.
I do not destroy it but only click on the x in upper right corner. So somewhere there is an implicit destroy in the code or something is trashing the window/dialog somehow.
If you are using a window, then the default handler for the close button
will destroy the window, and unref and possibly destroy it's children.
You will need to connect a handler that hides the window instead of
destroying it:
dialog.addOnDelete((_, widget){ widget.hide(); return true; });
A dialog.run
does this for you, which is why you need to call hide
or destroy
when run returns.