[gtkada] Cell_Renderer_Combo: how to act on characters typed to show match in combo

Op de Coul, Manuel Manuel.op.de.Coul at uniper.energy
Thu Apr 26 13:41:41 CEST 2018


I see, then first try this, will be easier:

Result := Gtk_Entry(Get_Child (MyRendererCombo));

Cheers,
Manuel

From: Rob Groen [mailto:robgr at xs4all.nl]
Sent: donderdag 26 april 2018 13:30
To: Op de Coul, Manuel <Manuel.op.de.Coul at uniper.energy>
Cc: gtkada at lists.adacore.com
Subject: Re: [gtkada] Cell_Renderer_Combo: how to act on characters typed to show match in combo


Hoi Manuel,



Thanks for your answer. The thing is, I don't have a GtkCombo, instead it is a GtkCellRendererCombo. On the latter I can't do a Get_Entry. However, when googling on this topic, I found a hint: connect the renderer to signal "edited-started", in the handler one of the params is a GtkEditable. I suppose that is the entry I need to do what you suggest.

Regards, Rob




On 2018-04-26 11:52, Op de Coul, Manuel wrote:
Hoi Rob,

with Gtk.Entry_Completion; use Gtk.Entry_Completion;

      Result : Gtk_Entry;
      List   : Gtk_List_Store;
      Compl  : Gtk_Entry_Completion;
      Iter   : Gtk.Tree_Model.Gtk_Tree_Iter;

      Gtk_New (List, GType_Array'(GType_String, GType_String)); --example with two columns
-- fill this list with your items for example:

            Append (List, Iter);
            Set (List, Iter, 0, "item 1");

--create your combo box and renderer(s)

--create the entry completion

      Result := Get_Entry (The_Combo);

      Gtk_New (Compl);
      Set_Model (Compl, Gtk.Tree_Model.Gtk_Tree_Model(List));
      Set_Text_Column (Compl, 0);
      Set_Text_Column (Compl, 1);
      Set_Property (Compl, Text_Column_Property, 0);
      Set_Inline_Completion (Compl, True);
      Set_Popup_Single_Match (Compl, False);
      Set_Completion (Result, Compl);
      Unref (List);
      Unref (Compl);
      Combo_Box_Callback.Connect (The_Combo, "changed",
        Combo_Box_Callback.To_Marshaller (On_The_Combo_Changed'Access));
--end

Greetings,
Manuel

-----Original Message-----
From: gtkada-bounces at lists.adacore.com<mailto:gtkada-bounces at lists.adacore.com> [mailto:gtkada-bounces at lists.adacore.com<mailto:gtkada-bounces at lists.adacore.com>] On Behalf Of Rob Groen
Sent: woensdag 25 april 2018 9:20
To: gtkada at lists.adacore.com<mailto:gtkada at lists.adacore.com>
Subject: [gtkada] Cell_Renderer_Combo: how to act on characters typed to show match in combo

Hello,

With a Cell_Renderer_Combo in a Tree_View I would like to act on typed characters and show the nearest match in the Combo. The Cell_Renderer_Combo has the property Has_Entry_Property set to True.
However, I don't see an appropriate signal to react on, nor any way to get to the entry and associated buffer; that is needed to show the non-typed part of the match as being selected.

How can I do this with Gtkada?

Regards
Rob Groen

_______________________________________________
gtkada mailing list
gtkada at lists.adacore.com<mailto:gtkada at lists.adacore.com>
/no-more-mailman.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/gtkada/attachments/20180426/de8226ab/attachment-0001.html>


More information about the gtkada mailing list