Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

There are some things worth dying for. -- Kirk, "Errand of Mercy", stardate 3201.7


devel / comp.lang.ada / GEntry with autocomplete

SubjectAuthor
* GEntry with autocompleteGavin McCord
`* Re: GEntry with autocompleteDmitry A. Kazakov
 `- Re: GEntry with autocompleteGavin McCord

1
GEntry with autocomplete

<t03i9r$lmj$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6688&group=comp.lang.ada#6688

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: gavind.m...@gmail.com (Gavin McCord)
Newsgroups: comp.lang.ada
Subject: GEntry with autocomplete
Date: Mon, 7 Mar 2022 00:06:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <t03i9r$lmj$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 7 Mar 2022 00:06:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a828f6db650e19489a3089004b23dc08";
logging-data="22227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VAJfyTwifekr528YX+N8y45qM5IgYXNT76mpRoJdmSA=="
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:jiAyI3HoE5S3KcuCXCP2o8HvTTo=
 by: Gavin McCord - Mon, 7 Mar 2022 00:06 UTC

I'm looking at including a GEntry with autocomplete
in some code of mine, and have created a simple example,
test.adb, which I've constructed from tutorial examples
(though from other languages, such as Python and PHP).

with Gtk.Main;
with Gtk.Window; use Gtk.Window;
with Gtk.GEntry; use Gtk.Gentry;
with Gtk.List_Store; use Gtk.List_Store;
with Gtk.Tree_Model; use Gtk.Tree_Model;
with Gtk.Entry_Completion; use Gtk.Entry_Completion;
with Gtkada.Handlers; use Gtkada.Handlers;
with Glib; use Glib;

with test_cb; use test_cb;

procedure Test is
Win : Gtk_Window;
Entry_1 : Gtk_GEntry;
List_1 : Gtk_Tree_Model;
Iter_1 : Gtk_Tree_Iter;
Completion_1 : Gtk_Entry_Completion;
type Word_Array is Array (1 .. 3) of String (1 .. 5);
Words : Word_Array;
begin
Gtk.Main.Init;
Gtk_New (Win);
Win.Set_Title ("Window");
Win.On_Delete_Event (main_del'Access);
Win.On_Destroy (main_quit'Access);
Win.Set_Border_Width (10);

Words(1) := "Alpha";
Words(2) := "Bravo";
Words(3) := "Delta";

Gtk_New (List_1, (0 => GType_String)); -- 0 - the first column
for Count in 1 .. 3 loop
List_1.Append (Iter_1);
Set (List_1, Iter_1, 0, Words(Count));
-- 0 The first column
end loop;

Gtk_New (Completion_1);
Completion_1.Set_Model (List_1);
Completion_1.Set_Text_Column(0);

Gtk_New (Entry_1);
Entry_1.Set_Completion(Completion_1);
Win.Add (Entry_1);

Win.Show_All;

Gtk.Main.Main;
end Test;

Compilation fails at line 40 "Completion_1.Set_Model (List_1)"
with the error

test.adb:40:28: error: expected private type "Gtk_Tree_Model" defined at
gtk-tree_model.ads:195
test.adb:40:28: error: found type "Gtk_List_Store" defined at
gtk-list_store.ads:139

Presumably, I've missed something in translation.

Thanks for any help.

Gavin

Re: GEntry with autocomplete

<t04bjg$d4q$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6689&group=comp.lang.ada#6689

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!hzzNxxMX5IPvnEV4b74Cww.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: GEntry with autocomplete
Date: Mon, 7 Mar 2022 08:18:07 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t04bjg$d4q$1@gioia.aioe.org>
References: <t03i9r$lmj$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="13466"; posting-host="hzzNxxMX5IPvnEV4b74Cww.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Mon, 7 Mar 2022 07:18 UTC

On 2022-03-07 01:06, Gavin McCord wrote:

> Compilation fails at line 40 "Completion_1.Set_Model (List_1)"
> with the error
>
> test.adb:40:28: error: expected private type "Gtk_Tree_Model" defined at
> gtk-tree_model.ads:195
> test.adb:40:28: error: found type "Gtk_List_Store" defined at
> gtk-list_store.ads:139
>
> Presumably, I've missed something in translation.

See To_Interface function that does the conversion.

[GTK interfaces are tagged Ada types. Since full MI is unfortunately not
supported in Ada, explicit conversion are are needed]

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: GEntry with autocomplete

<t08psr$re8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6700&group=comp.lang.ada#6700

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: gavind.m...@gmail.com (Gavin McCord)
Newsgroups: comp.lang.ada
Subject: Re: GEntry with autocomplete
Date: Tue, 8 Mar 2022 23:46:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <t08psr$re8$1@dont-email.me>
References: <t03i9r$lmj$1@dont-email.me> <t04bjg$d4q$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 8 Mar 2022 23:46:35 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9a942f5a2ef0aac299e6c9b81a24efd7";
logging-data="28104"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AeGxlbs0KW+G3G9nyb2wgxsoe4ddB/uT+Kx8GtPwXxA=="
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:TBMmXowAVbabivYK7lbXCjW47z0=
 by: Gavin McCord - Tue, 8 Mar 2022 23:46 UTC

On Mon, 7 Mar 2022 08:18:07 +0100, Dmitry A. Kazakov wrote:

> On 2022-03-07 01:06, Gavin McCord wrote:
>
>> Compilation fails at line 40 "Completion_1.Set_Model (List_1)"
>> with the error
>>
>> test.adb:40:28: error: expected private type "Gtk_Tree_Model" defined
>> at gtk-tree_model.ads:195 test.adb:40:28: error: found type
>> "Gtk_List_Store" defined at gtk-list_store.ads:139
>>
>> Presumably, I've missed something in translation.
>
> See To_Interface function that does the conversion.
>
> [GTK interfaces are tagged Ada types. Since full MI is unfortunately not
> supported in Ada, explicit conversion are are needed]

Yes, that did the trick. Thank you.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor