mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement entry focus feature
This commit is contained in:
parent
ea776cac56
commit
4580c0ce6e
2 changed files with 12 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ abstract class Entry
|
||||||
protected string $_placeholder = '';
|
protected string $_placeholder = '';
|
||||||
protected string $_value = '';
|
protected string $_value = '';
|
||||||
protected bool $_visible = true;
|
protected bool $_visible = true;
|
||||||
|
protected bool $_focus = false;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +34,11 @@ abstract class Entry
|
||||||
$this->_visible
|
$this->_visible
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->_focus)
|
||||||
|
{
|
||||||
|
$this->gtk->grab_focus();
|
||||||
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
$this->gtk->show();
|
$this->gtk->show();
|
||||||
|
|
||||||
|
|
@ -134,4 +140,9 @@ abstract class Entry
|
||||||
{
|
{
|
||||||
return $this->gtk->get_visibility();
|
return $this->gtk->get_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function focus(): void
|
||||||
|
{
|
||||||
|
$this->gtk->grab_focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ class Response
|
||||||
{
|
{
|
||||||
if ($focus)
|
if ($focus)
|
||||||
{
|
{
|
||||||
$this->query->gtk->grab_focus();
|
$this->query->focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($placeholder))
|
if (!is_null($placeholder))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue