[Gambas-user] ComboBox Error when ComboBox.Remove("1") / possible bug in gb.gtk?

Nicolas Koch nkoch22 at ...626...
Thu Nov 27 01:06:06 CET 2008


I am in Gambas 2.9

And even if I do ComboBox.List = Dir(sPath)  hidden folders show.  I
was trying to hide those and ComboBox1.Remove("1") was the only way I
could find that works.  It works but spits out error as I said.


Nick

On Thu, Nov 27, 2008 at 2:50 AM, Benoit Minisini
<gambas at ...1...> wrote:
> On jeudi 27 novembre 2008, Nicolas Koch wrote:
>> Hello Gambas Users,
>>
>> Ok an interesting problem I've noticed in gb.gtk or with gb.gui.  If
>> you have a ComboBox with items in it and you try to hide one of the
>> items from listing invoking ComboBox1.Remove("1") you'll get this
>> error.
>>
>> (test 26729): Gtk-WARNING **: gtktreemodel.c:429: Negative numbers in
>> path -1 passed to gtk_tree_path_new_from_string
>>
>> The reason why I am trying to hide the hidden folders beginning with .
>> but show the non hidden folders in the ComboBox1
>>
>> Although the console spits out this error it does what it is supposed
>> to and removes the hidden folder.
>>
>> There is no error on gb.QT and works with the same code.
>>
>
> I don't have the warning, so I think you should upgrade to Gambas 2.9, or wait
> for Gambas 2.10.
>
>> Without ComboBox1.Remove("1") the error disappears and shows hidden
>> folders like the following
>>
>> .data
>> save
>> pictures
>> tmp
>>
>> With ComboBox1.Remove("1") the error shows, but works
>>
>> save
>> pictures
>> tmp
>>
>> Here is the code:
>>
>> PUBLIC $DIR AS String
>> PUBLIC sPath AS String
>> 'PRIVATE SHOW_HIDDEN_FILES AS Boolean
>>
>> PUBLIC SUB sPath($FILE AS String)
>>   sPath = "~/src/test"
>>
>>   ComboBox11.Clear
>>   FOR EACH $DIR IN Dir(sPath, "*")
>>     ComboBox1.Add($DIR)
>>   NEXT
>>   ComboBox1.Remove("1")
>>
>> END
>>
>>
>> Is there a better way of doing this?
>
> Many. :-)
>
> The argument of Remove is an integer, not a string.
>
> You should not create public global variables when you just need local
> variables.
>
> You can do: ComboBox.List = Dir(sPath)
>
> Regards,
>
> --
> Benoit Minisini
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list