Giter Site home page Giter Site logo

php-gui's People

Contributors

airtonzanon avatar alexmsilva avatar andreybolonin avatar bruninho18k avatar carusogabriel avatar chrispecoraro avatar czarnyzajaczek avatar davidwdan avatar everton3x avatar fabio-santos avatar gabrielrcouto avatar hevertonfreitas avatar johann-s avatar kingga avatar lafraga93 avatar leonnleite avatar peratx avatar pierstoval avatar pokemaobr avatar qbitza avatar radarhere avatar reisraff avatar rodrigowbazevedo avatar rogeriopradoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-gui's Issues

>=5.6 Makes Apps Not Distributable on OS X

OS X 10.11 natively comes with PHP 5.5, having 5.6 as a requirement makes apps built in this not easily redistributable, as they require the end user to have a non-system version of PHP.

My end goal for app building would be to have these usable by people who don't need to know or care about PHP, at all. They should have no reason to even know my app is developed in PHP.

Get a property value

When we will get a component property ($button->value), it will be need to:

  • Send a command to Lazarus
  • Block PHP until the command response
  • Return the property value

JSON ERROR: TCarbonClipboard.Create Error: PasteboardCreate primary selection failed with result -4960

=> Sent: {"id":34,"method":"setObjectProperty","params":[10,"top",136],"callback":{}}
=> Sent: {"id":35,"method":"setObjectProperty","params":[10,"caption","\u64ad\u653e"],"callback":{}}
=> Sent: {"id":36,"method":"setObjectProperty","params":[10,"width",50],"callback":{}}
=> Sent: {"id":37,"method":"setObjectEventListener","params":[8,"onclick"],"callback":{}}
=> Sent: {"id":38,"method":"setObjectEventListener","params":[10,"onclick"],"callback":{}}
JSON ERROR: TCarbonClipboard.Create Error: PasteboardCreate primary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate secondary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate clipboard failed with re{"id": 5, "result": 1}

Fatal error: Uncaught Gui\Exception\ComponentException: [0]: JSON ERROR: TCarbonClipboard.Create Error: PasteboardCreate primary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate secondary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate clipboard failed with re{"id": 5, "result": 1}

i run my program many time, but today occur this error, this error occur first time. who know this error?

Call an object method

Sometimes we will need to call a object method, like ScrollBy(DeltaX, DeltaY) for scrolling a text field.

Standard handle pipes do not work the same on Windows

Unfortunately, Windows itself does not support non-blocking I/O on Windows pipes, which includes the standard handles used for CreateProcess(). It's an issue leftover from the early days of Windows and not something that Microsoft can easily fix or they would have already fixed it. You've accidentally run into a fundamental low-level Win32 CreateProcess() API bug. Since standard handles are almost always blocking pipes, an application might be expecting input on stdin while, at the same time, PHP is blocking while waiting for output on stdout. That, of course, creates difficult-to-diagnose issues resulting in application freezes usually on the PHP end of things. This behavior only happens on Windows and it's an easy issue to miss in cursory testing.

However, there is a workaround for standard handle applications where there is no source code control available or where the code would be too complicated to fix on the application's end of things:

https://bugs.php.net/bug.php?id=47918

An alternative could be to set up a localhost TCP/IP server on a random port (via port 0) in the PHP application, then start the Lazarus app and send the port number as part of the command line arguments or environment variables. The Lazarus app picks off the port number and connects back into the PHP application using a TCP/IP socket. Both sides enable non-blocking mode. At that point, the PHP side can terminate the TCP/IP server since it won't need to accept any more connections and then communication happens over localhost TCP/IP. By using TCP/IP, both the application and PHP can completely avoid the issue of attempting to use blocking stdin/stdout for non-blocking bidirectional IPC.

Since this project depends on react/child-process, the following bug report is relevant:

reactphp/child-process#9

I found PHP-GUI while evaluating options for solving a chicken-or-the-egg problem. Given the size of the binaries in this project and what I know about standard handle issues on Windows for IPC, I'm probably going to pass and try to figure out something simpler.

Side note: Each GitHub project is limited to 1GB total storage. Pure source code repos will likely never hit that limit. Large binaries that change frequently can use that storage up pretty quickly - I hit one of GitHub's internal storage limits once upon a time. This repo currently uses around 120MB of storage according to: https://api.github.com/repos/gabrielrcouto/php-gui Just something to keep in mind. On a related side-note, I've always been impressed with the extremely small file sizes of both the useful native Windows software produced by nirsoft and those participating in the not-as-useful-but-cool 4k and 64k demoscenes.

GetObjectProperty does not work for properties in collection format

I am trying to implement TFileNameEdit and I encountered problems using the DialogFiles property to return the selected files, regardless of whether or not the ofAllowMultiSelect is used.

TFileNameEdit.DialogFiles seems to return a string collection with the name of the selected files. The return type is TStrings.

From what I saw in the source code in Lazarus, TIpcThread.GetObjectProperty always returns a string, but in the specific case the conversion done by VarToStr (propertyValue) is not returning anything.

In addition could you tell me the way to fix this, since TFileNameEdit only provides that property to access all the selected files.

Suggestion to rename component: Radio to RadioGroup

The Radio component implements TRadioGroup. It would not be more appropriate to rename it to RadioGroup since there is also a component in LCL called TRadioButton. I understand that within the proposal to bring the nomenclature of components to the Web nomenclature, this change was in keeping with the fact that the present Radio is in fact a group of Radios.

Run without console

Is it possible to run applications written without opening the console in the background?

Convert RGB to TColor

For PHP, it's more easy to use RGB on color properties. On Lazarus, we will need to convert the RGB to TColor (and vice-versa).

Protocol

Good Idea..
Looks similar to GTKserver Project. ( so why restrained with just PHP, right? )
Seperating GUI and App Logic should eliminate UI hangout problems inherent in PHP GUI solutions. ( unless protocol is "sync". )
I compiled the executable but...
Is there a protocol documention? ( So one may write his/her own proxy libs. )
How we talk to executable? (I am illiterate in Pascal)

Keep up the excellent work...

$application->getWindow() work not well in example demo

See: vendor/gabrielrcouto/php-gui/examples/03-window/example.php 【PHP with version 7.2.0 NTS】

$button->on('click', function () use ($button, $application) {
    $window = ($application->getWindow());
    //var_dump($application->getWindow());
    if ($window->getHeight() == 600) {
        $window->setHeight(300);
    } else {
        $window->setHeight(600);
    }
   
    $button->setCounter($button->getCounter() + 1);
    $button->setValue('Your window was resized ' . $button->getCounter() . ' time(s), click to resize again!');
});

found the "onClick" event was emitted only once, and then i have a debug for "var_dump($application->getWindow())" , also output nothing on terminal. TKS.

Uncaught LogicException: Windows isn't supported due to the blocking nature of STDIN/STDOUT/STDERR pipes

hello,

I get this with PHP 7.2.6 x86

C:\Users\Momchil\Desktop\PHP-GUI>php examples\01-basic\example.php
PHP Fatal error: Uncaught LogicException: Windows isn't supported due to the blocking nature of STDIN/STDOUT/STDERR pipes. in C:\Users\Momchil\Desktop\PHP-GUI\react\ChildProcess\Process.php:52
Stack trace:
#0 C:\Users\Momchil\Desktop\PHP-GUI\src\Application.php(286): React\ChildProcess\Process->__construct('.\phpgui-x86_64...', 'C:\Users\Momchi...')
#1 C:\Users\Momchil\Desktop\PHP-GUI\examples\01-basic\example.php(82): Gui\Application->run()
#2 {main}
thrown in C:\Users\Momchil\Desktop\PHP-GUI\react\ChildProcess\Process.php on line 52

Running all latest sources from GitHub
So, Windows is no more ?

Add ProgressBar support

Hi! I guess ProgressBar support will be great.
I've tried to create \Gui\Components\ProgressBar, with $lazarusClass = 'TProgressBar';, but it doesn't work at all. I'm just not familiar with lazarus :-)

Hi

What is this can we create desktop application using php???

Screen freezing

Hello guys,

I've been using Ubuntu for a while and I tried to run the code shown in README.md file but my screen just freeze when I run it.

<?php
require 'vendor/autoload.php';

use Gui\Application;
use Gui\Components\Button;

$application = new Application();

$application->on('start', function() use ($application) {
    $button = (new Button())
        ->setLeft(40)
        ->setTop(100)
        ->setWidth(200)
        ->setValue('Look, I\'m a button!');

    $button->on('click', function() use ($button) {
        $button->setValue('Look, I\'m a clicked button!');
    });
});

$application->run();

My O.S : Ubuntu 14.04

any ideas ?

Multiple Forms Support

Currently, we have a self created main form (Form1). The ideia is to:

  • add the main form to objects array
  • add the method getMainForm into the Application
  • add a Form parameter to object constructor. If null, will be created into the mainForm.

Multiple Continuos IPC messages performance

In example "05-canvas" is possible to see what happens when multiple IPC messages are sent. After a while, the messages are ignored by Lazarus, the GUI still works, but don't receive anymore new IPC messages (still sends).

Can be:

  • The buffer size
  • The JSON performance
  • The Lazarus thread reading performance
  • The need of a protocol like TCP, based on a pool (PHP only sends message 2 after the confirmation of message 1).

Why would you use this over something like Electron?

Curious as to how php-gui compares. Both are targeted at builing cross platform apps, but surely php-gui is more a niche with it's own api (millions of devs already know HTML/CSS than a custom api to build a GUI).

When would you choose php-gui over something like Electron?

php-gui applications instantly crash on OS X

Hey,

I did some extensive testing with the library today and found that most applications crash on startup. I've tried all the examples available in the repository and only 02 and 06 could be started successfully.
Running phpunit gave me this warning:

1) Test\Components\ObjectTest::testMagicCall
Trying to configure method "__call" which cannot be configured because it does not exist, has not been specified, is final, or is static

All other tests passed without any warnings.

I tested with both the current development branch and the 1.0 release on Mac OS X El Capitan 10.11.4. I'm using PHP 7.0.7.

How to close main window, and some advice.

I used

$closeButton->on('click', function() use ($application) { exit(); });

to close the window, the php process is exit, but the window is still exists.
and a little time later, some error happend.

And hope have some feature to use xml file to create ui.

@todo

File Todo PRs Done
src/Application.php:200 @todo: Check if the object exists #51
src/Application.php:316 @todo: Put the message on a poll
src/Application.php:335 @todo: Put the message on a poll
src/Components/Radio.php:33 @todo: throw an exception #88
src/Ipc/Receiver.php:141 @todo: throw an exception #58
src/Ipc/Receiver.php:253 @todo: Command implementation
src/Ipc/Sender.php:129 @todo: throw an exception

TOpenDialog method

Hello! I rebuild the lazarus and I added the TOpenDialog.
RegisterClass(TOpenDialog);

And when I "Execute", its not working
I'm calling like this:
$this->call('execute', []);

Where is my mistake?
Sorry for my English!

php7.2 Fatal error

Fatal error: Cannot use Gui\Components\Object as Object because 'Object' is a sp
ecial class name in D:\phpgui\vendor\gabrielrcouto\php-gui\src\Application.php o
n line 5

Not urgent,but would be a problem.

big thanks for this project!

PHP 7.2 Incompatibility Issue

Object is no longer a valid class name since php 7.2 php/php-src@8e10c9d

PHP Fatal error:  Cannot use Gui\Components\Object as Object because 'Object' is a special class name in /tmp/vendor/gabrielrcouto/php-gui/src/Application.php on line 5
PHP Stack trace:
PHP   1. {main}() /tmp/myapp.php:0
PHP   2. spl_autoload_call() /tmp/myapp.php:7
PHP   3. Composer\Autoload\ClassLoader->loadClass() /tmp/myapp.php:7
PHP   4. Composer\Autoload\includeFile() /tmp/vendor/composer/ClassLoader.php:322

Fatal error: Cannot use Gui\Components\Object as Object because 'Object' is a special class name in /tmp/vendor/gabrielrcouto/php-gui/src/Application.php on line 5

Call Stack:
    0.0002     450856   1. {main}() /tmp/myapp.php:0
    0.0013     530784   2. spl_autoload_call() /tmp/myapp.php:7
    0.0013     530864   3. Composer\Autoload\ClassLoader->loadClass() /tmp/myapp.php:7
    0.0014     530992   4. Composer\Autoload\includeFile() /tmp/vendor/composer/ClassLoader.php:322

Autofocus of window would be great

Running examples I realize that the window php-gui opens are hidden behind other applications, I guess the issue is because of Autofocus not being used yet.

Keyboard Input

Is there something like a keydown on some object that isn't inputText? I couldn't find something like that :/

Installation failure from Composer

composer require gabrielrcouto/php-gui

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Using version ^0.1.0 for gabrielrcouto/php-gui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for gabrielrcouto/php-gui dev-master -> satisfiable by gabrielrcouto/php-gui[dev-master].
- Can only install one of: gabrielrcouto/php-gui[v0.1.0, dev-master].
- Installation request for gabrielrcouto/php-gui ^0.1.0 -> satisfiable by gabrielrcouto/php-gui[v0.1.0].

Installation failed, reverting ./composer.json to its original content.

How to compile?

I'm currently using PHP-GUI wrote a program, how to compile it into exe?

Three Package is abandoned :(

Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.

Add vendor folder in "src" to correct the PSR-0

In PSR-0 a fully-qualified namespace and class must have the following structure:
\<Vendor Name>\(<Namespace>\)*<Class Name>

And the current structure of php-gui don't have a vendor name. Why?

Bug: Gui\Ipc\Receiver

sometimes the $application->process->stdout wait for a some data length to write, and with it, the Receiver::onData() can't to process the message because sometimes the message came that way:

{"id": 6, "result": 2}Get: {"callback":{},"id":7,"method":"setObjectEventListener","params":[2,"onclick"]}

As you can see, after the end of the 1st JSON is the letter "G", and it's beeing sent by the lazaruz binary.

So, with the following condition the PHP goes inside the if statement, but in the next instruction the json can not be decoded.

if ($data[0] === '{' && $data[strlen($data) - 1] === '}') {
    $message = json_decode($data);
// ...

I can see 2 way to solve it;

  1. to send by lazarus a custom json with the key "received" or "debug" or something like this, and in receiver ignore all jsons that come with this key.
  2. stop to send messages that aren't part of the communication

PS: with this bug the Gui\Ipc\CommandMessage callback doesn't work

And as the process->stdout works that way, I mean that sometimes the Receiver::onData() can receive 2 or more jsons, and it MUST be splitted. and it is not being done.

iOS

Which there was an easy way to get a PHP+SQLITE stack up and running on iOS ;)
Then one could deploy the same app to clients as to the server (distributed software system)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.