From 4580c0ce6ebcfd5a44111a5edc11cc2cac20dc4f Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 8 Jul 2024 02:55:56 +0300 Subject: [PATCH] implement entry focus feature --- src/Abstract/Entity/Entry.php | 11 +++++++++++ src/Entity/Browser/Container/Tab/Page/Response.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Abstract/Entity/Entry.php b/src/Abstract/Entity/Entry.php index 68d76de..e1a0c45 100644 --- a/src/Abstract/Entity/Entry.php +++ b/src/Abstract/Entity/Entry.php @@ -12,6 +12,7 @@ abstract class Entry protected string $_placeholder = ''; protected string $_value = ''; protected bool $_visible = true; + protected bool $_focus = false; public function __construct() { @@ -33,6 +34,11 @@ abstract class Entry $this->_visible ); + if ($this->_focus) + { + $this->gtk->grab_focus(); + } + // Render $this->gtk->show(); @@ -134,4 +140,9 @@ abstract class Entry { return $this->gtk->get_visibility(); } + + public function focus(): void + { + $this->gtk->grab_focus(); + } } \ No newline at end of file diff --git a/src/Entity/Browser/Container/Tab/Page/Response.php b/src/Entity/Browser/Container/Tab/Page/Response.php index 3396723..67ceafd 100644 --- a/src/Entity/Browser/Container/Tab/Page/Response.php +++ b/src/Entity/Browser/Container/Tab/Page/Response.php @@ -87,7 +87,7 @@ class Response { if ($focus) { - $this->query->gtk->grab_focus(); + $this->query->focus(); } if (!is_null($placeholder))