Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How can I setup right collating sequence in GridCtrl?
How can I setup right collating sequence in GridCtrl? [message #19378] Sat, 29 November 2008 16:08 Go to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I try use GridCtrl with MySQL. On number column sorting work fine, but on String columns sorting very strange. How to setup right collating sequence in GridCtrl. Please Help

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I setup right collating sequence in GridCtrl? [message #19514 is a reply to message #19378] Wed, 10 December 2008 08:23 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

sergeynikitin wrote on Sat, 29 November 2008 10:08

I try use GridCtrl with MySQL. On number column sorting work fine, but on String columns sorting very strange. How to setup right collating sequence in GridCtrl. Please Help

What you mean exactely. GridCtrl just uses Value comparator. So if value is String - String comparator will be used, if value is WString - WString comparator will be used and so on.
Re: How can I setup right collating sequence in GridCtrl? [message #19521 is a reply to message #19514] Wed, 10 December 2008 21:48 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Yes, I understand. I have found in sources ...

But if you are prompted for example, I would be grateful.

Thanks in advance.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I setup right collating sequence in GridCtrl? [message #21123 is a reply to message #19521] Mon, 04 May 2009 12:22 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I propose to do in .t file a line like "ABCDEFG ...... abcdefg ..... vwxyz ...." with the correct sequence of characters, then when you switch the language will work correctly sort and compare strings.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I setup right collating sequence in GridCtrl? [message #21142 is a reply to message #21123] Tue, 05 May 2009 09:07 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
sergeynikitin wrote on Mon, 04 May 2009 12:22

I propose to do in .t file a line like "ABCDEFG ...... abcdefg ..... vwxyz ...." with the correct sequence of characters, then when you switch the language will work correctly sort and compare strings.


Will not work for all languages in this simple form. For example cz and sk have special character "ch" (between "h" and "i" in alphabet). The funny thing is, that this correct local sorting always annoys hell out of me and I absolutely hate it (and never ever needed it). Then again, most of the time I use English anyway.
Re: How can I setup right collating sequence in GridCtrl? [message #21149 is a reply to message #21142] Tue, 05 May 2009 14:23 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

And this line "ABCDEFGH¨IJ......abcdefgh¸ij....." solved the problem?
¨ - is your "ch" character.

For example this might look like this:

csCZ_Collating_Sequence("ABCDEFGH¨IJ......abcdefgh¸ij.....")
deDE_Collating_Sequence("ABCDEFGHIJ......abcdefghij.....")
ruRU_Collating_Sequence("ABCDEFGHIJ......abcdefghij.....ÀÁÂÃÄ.....àáâãä....")


And then switched the language, both switches and sorting mechanism.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I setup right collating sequence in GridCtrl? [message #21161 is a reply to message #19378] Wed, 06 May 2009 09:01 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
but "ch" are two chars, "c" and "h", there is never "ch" character in fonts, because it was always written from the two. Maybe I just don't understand you, and there's some hidden way how to convert your ¨ to two chars and work with it later, but I'm missing definition of that extra behavior in the simple lines you posted.

[Updated on: Wed, 06 May 2009 09:01]

Report message to a moderator

Re: How can I setup right collating sequence in GridCtrl? [message #21162 is a reply to message #21161] Wed, 06 May 2009 09:28 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

No, Sorry. I'm not quite clear.

This is a problem with the editing of Unicode characters in the forum.

J - it was an attempt to insert the letter, with emphasis. (Precisely what it turned out)

That is, there is a letter designating the ch or just a couple of characters in the alphabet? I do not understand.

!!!
But in any case to establish the sort in the same line used MySQL Collating Sequence, which has consistently recorded the entire alphabet, letter for letter, usually starting with English letters and ending with the national.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Wed, 06 May 2009 09:36]

Report message to a moderator

Re: How can I setup right collating sequence in GridCtrl? [message #21166 is a reply to message #21162] Wed, 06 May 2009 10:39 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
sergeynikitin wrote on Wed, 06 May 2009 09:28

That is, there is a letter designating the ch or just a couple of characters in the alphabet? I do not understand.


That's the tricky part about it. In Czech alphabet "ch" is single letter, and for example dictionaries are sorted by it, i.e. you have:
banik, cislo, frajer, hroch, chyba, ikra
(notice position of "cislo" and "chyba")

But it is written from regular "c" and "h" letters.

This did lead to a situation where in the digital land the "ch" is always represented by regular "c" and "h" characters, i.e. the single "ch" letter is formed in digital data by regular two characters.
This means that in correct cs/sk sort you have to compare not just single character (bytes), but in case you hit "c", you have to look ahead for next character, if it is "h", you have special case.

Unless you use special substitution character for every "c" "h" pair before sort, and then replace it back, you can't cover this behavior by simple order-table.

edit:
If my personal opinion would count, I would discard "ch" immediately from our alphabets, so all the "ch" words would be created from regular "c,h" pairs, i.e. pretty much the current situation except weird sort and weird letter count.
Then again, if my personal opinion would count, there would be no Russian alphabet at all, because I said in school once at Russian lesson: "a nation which is unable to learn+use English 26 letter alphabet will vanish in future". Smile (I was 10 years old at that point and I was so glad ASCII standard existed, so I hope you will understand it a bit)
Since then I admit the utf-8 may be remedy of current status, still if everyone would switch to ASCII 20 years ago and discard all funny chars (and we got much more of them then just "ch", plenty of accented ones too), I bet the current SW would be much smoother ride and lot more cheaper then it is.... Very Happy

[Updated on: Wed, 06 May 2009 10:46]

Report message to a moderator

Re: How can I setup right collating sequence in GridCtrl? [message #21167 is a reply to message #21166] Wed, 06 May 2009 11:26 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I do not understand what it contradicts.

If there is a complex situation with a number of scripts, rather hard-ASCII heritage. That does not mean that you do not need to enter the normal Unicode tools.

I understand that the above problem is not everywhere, but only in certain applications.

In any case, the MySQL and PostfreSQL solve this problem the way that I proposed for U++.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I setup right collating sequence in GridCtrl? [message #21217 is a reply to message #21166] Sun, 10 May 2009 08:26 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

mr_ped wrote on Wed, 06 May 2009 12:39

Then again, if my personal opinion would count, there would be no Russian alphabet at all, because I said in school once at Russian lesson: "a nation which is unable to learn+use English 26 letter alphabet will vanish in future". Smile (I was 10 years old at that point and I was so glad ASCII standard existed, so I hope you will understand it a bit)
Excuse me for little offtopic.
National features topic is a delicate one. It all depends on a balance. You may always choose between simplicity and possibilities. For example, when we talk about language, we all know about international, or basic English. It is a subset of common English language (rather tiny comparing to Britain English). Basic English is an example of simplicity. But it has no way to say anything beyond the scope of anything common (i.e. you can`t translate any national object or any specific thing, feeling except of those predefined subset).
Contrary each national language has unique features but less simple. This unique information is commonly contained in writing system itself and turning it into basic English alphabet will petrify 90% of this information.
Let`s take Chinese as an example. It has a number of delicate definitions which have no equivalents not only in basic English but in many other languages too. More of that. Hieroglyphic system contains information on national mentality. For example there`s hieroglyph "woman". And hieroglyph "woman" under "roof" means calm, peace of mind. Hieroglyph consisting of two "woman" hieroglyphs mean "scandal" Very Happy (IMO it`s cool!). Even more, hieroglyph consisting of three "woman" means even greater scandal or debauch (cool!). I consider this writing system very logical and intuitive. And it is certainly worth keeping.
Some languages have 5-10 words describing love (with delicate differences each other), or even many-many words describing beauty of nature.
When we talk about cyrillic writing system we have even more delicate information layer based on radicals and other parts of a word. More interesting is these radicals are common between most of slavonic languages. For example when you know 2 or 3 of them, you may possibly translate text from i.e. Polish or Chech. It is closely related to cyrillic letters which introduce logical system of radicals (with their geographic/historic variations) keeping some kind of unity between any slavonic language (and mentality as consequence).
As a conclusion I`d say that basic English is a good tool for me if I want anyone from outside to understand me. But each nation has something unique which is closely related with their language and writing system. IMO it is worth keeping especially comparing to the alternative of petrifying process of thinking with switching to basic English. Again, Britains themselves use English which is more complex and rich than basic one.
Re: How can I setup right collating sequence in GridCtrl? [message #21226 is a reply to message #19378] Sun, 10 May 2009 11:40 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
I hope you didn't miss the "10 year old" part of my comment.
I did evolve since then a bit. Wink
Still interesting reading, thank you.

[Updated on: Sun, 10 May 2009 11:40]

Report message to a moderator

Previous Topic: ArrayCtrl whenSBchange
Next Topic: GridCtrl problem
Goto Forum:
  


Current Time: Sat Apr 20 16:26:26 CEST 2024

Total time taken to generate the page: 0.03815 seconds