[Gambas-user] Combobox1.sort=true sorts different then Astring.sort

gaupe hennie at ...1826...
Wed Jan 9 16:04:59 CET 2008


ron thanks for the complete explanation of how qt does this


i get the system 
and the example was not in one sequential order
the second one was standalone and 
combobox1.sort was default false so id did what you suggest there later.

My meaning however stays that i now have to, in one language constantly
think.


ehhh... sort was it the interpreter was it qt was it sometehing else...

it gets confusing 

same with the utf-8 thingy in gambas

as soon as you go out of the standard simple ascii you suddenly are
confronted with the fact that
asc and chr do not get utf-8
and have to use other means like string.length and so on to solve it.

one time you can use len($this)
the other time you have to use string.length(this) (or was it another
synax.. youll get wat im aiming at i guess)

would be nice in my opinion that all would use One standard.


But hey thats life and i can live with it ;-)




Ron Onstenk wrote:
> 
> On Wednesday 09 January 2008 12:09, gaupe wrote:
>> 
>> Why does the combobox.sort=true
>> sort different then a sort in a string array?
>> would be very confusing (if i didnt make a mistake :-/)
>> 
>> if i have 
>> 
>> dim Astring as new string[]
>> 
>> ["-this-","Ape"]
>> 
>> then 
>> 
>> combobox1.list=Astring
>> combobox.sort=TRUE
>> 
>> first item in list will be "Ape"
>> 
>> gives a different result from
>> 
>> astring.sort
>> combobox1.list=astring
>> combobox.sort=FALSE
>> 
>> First item in list will be "-this-"
>> 
>> 
> 
> If you sort the string array it sorts the value of each entry.
> The key of the items are keep to the entry and are mangled.
> Here now as [1], [0]
> 
> I asume next hapens:
> 
> 1)
> When you put the array into the combobox the entry order (keys)
> are in sequential order restored by qt. 
> Setting 'combobox.sort=FALSE' should not change the values.
> Setting 'combobox.sort=true' should  order the values.
> 
> 
> 2) The values are in the same order as the array after 'astring.sort'
> and the keys are mangled.
> Setting 'combobox.sort=FALSE' tels QT to restore the sequential order 
> by key values.
> 
> 
> 
> Alternatives:
> 
> When you copy the sorted values from astring entry by entry to a new 
> string array (bstring) wich reorders the key in the same order as values.
> After the copy do combobox1.list=bstring.
> 
> You can also add the items with foreach to the combobox after the
> astring.sort.
> In this way 'combobox.sort=FALSE' should not change the order.
> 
> 
> 
> Ron
> 
>> Because QT sorts differently than the interpreter.
>> 
> As Benoit says
> 
> The '-' and '_' (minus and underscore) behaviour with sorting in qt
> is also noticed in konqueror with filenames.
> starting with '-' to get it as first in directory listing does not work.
> It takes the first alfabet character instead of '-' or '_'.
> Anyway at my box with kubuntu.
> 
> 
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Combobox1.sort%3Dtrue-sorts-different-then-Astring.sort-tp14709719p14713709.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list