scorninpc / php-gtk3

GTK3 extension for PHP
https://andor.com.br/
GNU Lesser General Public License v3.0
119 stars 13 forks source link

GtkEntryCompletion::match_selected event does not return iter but GdkEvent instead #138

Closed d47081 closed 4 months ago

d47081 commented 4 months ago

Seems match-selected event returns another data types than documented:

<?php
        $this->gtk->connect(
            'match-selected',
            function(
                GtkEntryCompletion $completion,
                GdkEvent $event
            ) {}
        );

https://docs.gtk.org/gtk3/vfunc.EntryCompletion.match_selected.html

gboolean
match_selected (
  GtkEntryCompletion* completion,
  GtkTreeModel* model,
  GtkTreeIter* iter
)

so I can't get current selection, or how by GtkEntryCompletion $completion object returned only?

upd.

maybe I must to use GtkTreeView as the model, then extract selection using this method:

        list(
            $list,
            $row
        ) = $this->gtk->get_selection()->get_selected();

        if ($list && $row)
        {
            if ($value = $list->get_value($row, $column))
            {
                return $value;
            }
        }

but anyway, strange there is no way to simply get iter by this event..

d47081 commented 4 months ago

Sorry, I have provided GtkListStore not GtkTreeModel to EntryCompletion constructor.

https://docs.gtk.org/gtk3/method.EntryCompletion.set_model.html

but don't understand why events has own API, not documented argument types. maybe php-gtk3 implementation just.