Close application in PHP-GUI

Asked

Viewed 87 times

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 :

inserir a descrição da imagem aqui that of reply:

The question is:

Using that library (the same used above), how to terminate that application ?

  • Have you tried $app->terminate(); ?

  • From what I see in the documentation it may be $app->fire("exit");

  • @cat yes, it doesn’t finish anything

  • @lazyFox also does not work, I think it is with the fire method, but still is not giving

  • @Anthraxisbr have you checked if the click event is being fired correctly? No need to import the Button namespace Gui\Components\Button; ?

  • @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

  • You also have the protected variable $running within the Gui\Application Defines if the application is running

  • See if this helps have several interesting methods

  • @lazyFox using the 'running' status of the application, with ->terminate() it exits the process running on the terminal, but does not close the interface

Show 4 more comments

1 answer

2


Browser other questions tagged

You are not signed in. Login or sign up in order to post.