|
|
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Row numbering inconsistency
Row numbering inconsistency [message #12461] |
Sat, 03 November 2007 15:33  |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hi Daniel,
I am looking to be able to make an interface in which users can effectively edit their column headers so I am intending to hide the real column headers and create a zero row which looks like a column header but is editable.
I noticed that GridCtrl::HideRow(0) hides the column headers which is great but that GridCtrl.GetRow(1).SetFont(StdFont().Bold()) changes the 2nd row to bold and this is what I would expect as the GridCtrl contents are addressed from a zero index. However,this means that HideRow and GetRow are working with different numbering systems. What say you? I know that I can easily work around this and I will but shouldn't the numbering be consistent? I suggest a separate function to hide the column headers.
Also, now you know what I'm trying to do, is there a better way please? Ideally I would have real editable column headers with their own edit controls as this would allow me to sort the contents still using your sort rather than having to write my own. Plus, I'm not sure how to get my fake column headers to look like your swanky ones 
Nick
p.s. on second thoughts fixing this would break lots of people's code so maybe its not worth it. I've noticed though that there are other functions which refer to the headers as the zeroth row such as SetFixed() and so on. Perhaps the headers could be the -1 row?
[Updated on: Sat, 03 November 2007 15:56] Report message to a moderator
|
|
|
Re: Row numbering inconsistency [message #12495 is a reply to message #12461] |
Mon, 05 November 2007 22:50  |
|
Quote: | I am looking to be able to make an interface in which users can effectively edit their column headers so I am intending to hide the real column headers and create a zero row which looks like a column header but is editable.
|
Well, it's very uncommon. It would be uneasy now to allow gridctrl to do that. However your trick is interesting 
Quote: | I noticed that GridCtrl::HideRow(0) hides the column headers which is great but that GridCtrl.GetRow(1).SetFont(StdFont().Bold()) changes the 2nd row to bold and this is what I would expect as the GridCtrl contents are addressed from a zero index. However,this means that HideRow and GetRow are working with different numbering systems. What say you? I know that I can easily work around this and I will but shouldn't the numbering be consistent? I suggest a separate function to hide the column headers.
|
Yes, you're right. I should provide HideFixedRow and make fixed_row based index in HideRow. I'll add it to my to-do list.
Sometimes I add method only to internal grid use (which use 0 based indexing), but later I need it in the outside world (like in DropGrid) and I modify access level forgeting at the same time to fix numbering issues. That's the whole story 
Quote: | Also, now you know what I'm trying to do, is there a better way please? Ideally I would have real editable column headers with their own edit controls as this would allow me to sort the contents still using your sort rather than having to write my own. Plus, I'm not sure how to get my fake column headers to look like your swanky ones
|
No, there is no better way right now. At least I can't see it. To make an ordinary row look like the fixed one provide your own display (based on GridDisplay of course) and in Paint just call PaintFixed..
Quote: | p.s. on second thoughts fixing this would break lots of people's code so maybe its not worth it. I've noticed though that there are other functions which refer to the headers as the zeroth row such as SetFixed() and so on. Perhaps the headers could be the -1 row?
|
Negative indexing is not a good idea. It'v very troublesome and unintuitive IMO. I prefere add fixed equivalens like Set and SetFixed.
I plan to refactor a lot current Grid soon so I'll try make uncommon things much easier to implement (new Grid will be much more flexible (in terms of API)). So please reports your needs 
[Updated on: Mon, 05 November 2007 22:53] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 22:17:13 CEST 2025
Total time taken to generate the page: 0.00554 seconds
|
|
|