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 » GridCtrl sorting and segfaults
GridCtrl sorting and segfaults [message #16669] Mon, 07 July 2008 09:38 Go to next message
Sami is currently offline  Sami
Messages: 6
Registered: July 2008
Promising Member
Hi,

I clear the view and add completely new items into the GridCtrl. This messes up the current sorting. How do I re-sort, using the current settings the newly refreshed view? Also how do I manually set (for example) sorting enabled for the first column?

When I do not use debug mode, I get crash at LanguageInfo::Compare(WString,WString) (which I hacked by converting to String and doing strcmp) when I click GridCtrl header to sort a column containing c-strings (char *).

Thanks for the great library.

[Updated on: Mon, 07 July 2008 09:41]

Report message to a moderator

Re: GridCtrl sorting and segfaults [message #16675 is a reply to message #16669] Mon, 07 July 2008 12:27 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Quote:


When I do not use debug mode, I get crash at LanguageInfo::Compare(WString,WString) (which I hacked by converting to String and doing strcmp) when I click GridCtrl header to sort a column containing c-strings (char *).



Why did you hack it? There are other solutions.

LanguageInfo::Compare(String a, String b)
LanguageInfo::Compare(WString a, WString b)
LanguageInfo::Compare(const char *a, const char *b);
LanguageInfo::Compare(const wchar *a, const wchar *b);
LanguageInfo::Compare(const wchar *a, const wchar *b, int a_length, int b_length)


Also, you can convert a String to WString using (and vice versa);

 Upp::String   WString.ToString();
 WString       String.ToWString();



[Updated on: Mon, 07 July 2008 12:28]

Report message to a moderator

Re: GridCtrl sorting and segfaults [message #16676 is a reply to message #16675] Mon, 07 July 2008 13:56 Go to previous messageGo to next message
Sami is currently offline  Sami
Messages: 6
Registered: July 2008
Promising Member
Oblivion wrote on Mon, 07 July 2008 13:27


Why did you hack it? There are other solutions.



Because it has a bug? It's actually in LanguageInfo::Compare(const wchar *a,...).

Oblivion wrote on Mon, 07 July 2008 13:27


Also, you can convert a String to WString using (and vice versa);



I know, as I explained I use them.

One another thing, looking at the following:

int Compare(String a, String b) const { return Compare(a.ToWString(), b.ToWString()); }

...appears to be quite expensive (in such important function) if we have english characters only.
Re: GridCtrl sorting and segfaults [message #16681 is a reply to message #16669] Mon, 07 July 2008 17:20 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

As for bug - test case please Smile Right now there is now method to resort but it's a good idea and I will add it. I also consider adding AutoSort what would solve your second problem. Excpect it after rc2, which will be released today.
Re: GridCtrl sorting and segfaults [message #16682 is a reply to message #16681] Mon, 07 July 2008 18:16 Go to previous messageGo to next message
Sami is currently offline  Sami
Messages: 6
Registered: July 2008
Promising Member
unodgs wrote on Mon, 07 July 2008 18:20

As for bug - test case please Smile Right now there is now method to resort but it's a good idea and I will add it. I also consider adding AutoSort what would solve your second problem. Excpect it after rc2, which will be released today.


Thanks for the reply.

Admittedly I have spent time trying to figure out how to solve the resort(), because my app practically depends on it. Sorry if this sounds too annoying, but what "after" means? This week, or later? Just asking to decide should I invest more time on studying the code.

I get back to you about the bug later after the update, since it now works for me with the hack.

Yet another thing. I noticed there are quite large memory requirements in the control. What are the exact memory requirements?
Re: GridCtrl sorting and segfaults [message #16684 is a reply to message #16682] Mon, 07 July 2008 19:15 Go to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Quote:


Admittedly I have spent time trying to figure out how to solve the resort(), because my app practically depends on it. Sorry if this sounds too annoying, but what "after" means? This week, or later? Just asking to decide should I invest more time on studying the code.


I mean it should be in rc3 or final. Most probably it will be added in this week. I'm using a grid a lot (what a suprise Wink ) so I'm in grid code quite often.
Quote:


Yet another thing. I noticed there are quite large memory requirements in the control. What are the exact memory requirements?


Grid uses Vector<Vector<Value>> to store values. There are also 2 more vectors for storing rows and columns information. So it eats memory proportionaly to rows count.
Please tell how many columns/rows you have and what kind of Values do you use (also please write grid memory occupation size). Maybe memory usage grows as a result of some operations sequence?
Previous Topic: GridCtrl - copy all [Feature Request]
Next Topic: ArrayCtrl: is it possible to customize the deletion message?
Goto Forum:
  


Current Time: Sun Apr 28 18:26:28 CEST 2024

Total time taken to generate the page: 0.02309 seconds