0
Using PHP-GUI, start an application like this:
$app = new \Gui\Application([
'title' => 'G.M Personal APP',
'left' => 248,
'top' => 50,
'width' => 860,
'height' => 600,
'icon' => realpath(__DIR__) . DIRECTORY_SEPARATOR . 'G.M-=icon.png'
]);
$app->on('start', function() use ($app) {
$button = new Button([
'value' => 'Fechar aplicação',
'top' => 160,
'left' => 50,
'width' => 450
]);
$button->on('click', function () use ($button, $app)
{
//Aqui eu quero fechar a janela/aplicação e abrir o terminal
});
});
$app->run();
That gives me an answer :
The question is:
Using that library (the same used above), how to terminate that application ?
Have you tried
$app->terminate();
?– gato
From what I see in the documentation it may be
$app->fire("exit");
– lazyFox
@cat yes, it doesn’t finish anything
– AnthraxisBR
@lazyFox also does not work, I think it is with the fire method, but still is not giving
– AnthraxisBR
@Anthraxisbr have you checked if the click event is being fired correctly? No need to import the
Button
namespaceGui\Components\Button;
?– gato
@cat click triggers yes, the use of the namespace so indicated before, I can have any other interaction, the problem is on how to terminate the application only, neither of the two ways aq from above the comments returns error or success, but any other on click interaction q tried to work
– AnthraxisBR
You also have the protected variable
$running
within theGui\Application
Defines if the application is running– lazyFox
See if this helps have several interesting methods
– lazyFox
@lazyFox using the 'running' status of the application, with ->terminate() it exits the process running on the terminal, but does not close the interface
– AnthraxisBR