From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Filling a listsore real time Date: Sun, 9 Feb 2014 18:16:11 +0100 Organization: cbb software GmbH Message-ID: <1h25bpkw2iqp0.1je0swr7ficvt.dlg@40tude.net> References: <52f79b6b$0$26363$703f8584@news.kpn.nl> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dRN93LcgZmpMwxQ2TpSF2g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:18454 Date: 2014-02-09T18:16:11+01:00 List-Id: On Sun, 9 Feb 2014 16:13:03 +0100, ldries46 wrote: > In my program I want a combobox with a liststore that is every time the > dialog in which it is called has a different number of of iters and another > value within the iter. In this case the iters are from an array of > characters. > It looks like the Routine Set_Value or Set_Char is not correct working > because I checked the input for Set_Char gchar(ch) gives me the correct > Character. append also works correct, I get the correct number of items but > the items should be 1, 2, 3, 4, 5, 6, 7, 8, 9 and they are 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0 > > n1 := 0; > for nn in 1 .. max loop > if not Grid(x_vak, y_vak).impossible(n1) then > ch := CHARACTER'Val(Symbols(n1 ,Set)); > Set_Char(G_char, gchar(ch)); > append(CH_List, CH_Iter); > Set_Value(CH_List, CH_Iter, 0, G_char); > end if; > n1 := n1 + 1; > end loop; > > Can anyone tell me what I am doing wrong. Set_Value needs a GValue. A GValue object must be initialized, set and finally unset. E.g. a string with GValue: Text : GValue; Row : Gtk_Tree_Iter; Column : GInt := 0; begin Init (Text, GType_String); -- Initialize value as a string Set_String (Text, "Hello"); -- Set value into Text Store.Append (Row); -- Add a new row to the list store Store.Set_Value (Row, Column, Text); -- Set a cell in the store's row Unset (Text); -- Free memory allocated for value Which can be done in a simpler way without Set_Value. Gtk_List_Store_Record has a ready-to-use operation for setting strings: Row : Gtk_Tree_Iter; Column : GInt := 0; begin Store.Append (Row); -- Add new row to the store Store.Set (Row, Column, "Hello"); -- Set cell in the row Caution. This seems broken in GtkAda 3.4. AFAIK it causes memory corruption. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de