|
|
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » TreeGrid Control - Update 6
|
Re: TreeGrid Control - Update 6 [message #45833 is a reply to message #45827] |
Mon, 11 January 2016 15:08   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Hello slashupp
You have included in the zip just the demo but not the library. Please send the last version of the library.
Checking the code there are many things to be U++-ized:
- Sometimes it is used Upp::String and others std::string
- Loop indentation (for, if, while) is different
- Some function names does not begin with capital letter
- Some variable names does not begin with lower letter
- There is no space before/after "=", "==", "?", ":"
If you want I can do the changes for you.
Best regards
Iñaki
[Updated on: Mon, 11 January 2016 15:08] Report message to a moderator
|
|
|
Re: TreeGrid Control - Update 6 [message #45837 is a reply to message #45833] |
Tue, 12 January 2016 07:58   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
I attached TreeGrid.zip - contains treegrid as upp-project, hope that's what you meant with 'library'?
I used std::string mainly for expedience and knowing it better than String, using the latter where Upp-functions needs it, again for expedience.
Re: indentation, names (caps/lower-case, variables), spaces/spacing - is there a Upp-standards document you can point me too please?
Quote:If you want I can do the changes for you.
That would be very kind, and if you can put a copy of the fixed sources here so I can do comparison with mine and use as reference.
PS: Just an explanation for what you see in my source-code:
My personal 'standards' for coding are applied at the end when the code nears release(able)-status; before then I use the RAD-technique of Evolutionary Development (some-what similar to 'agile') and do not worry much about standards & style, the purpose being to test my algorithms and earliest detection of design issues, also: everything is public using structs or globals at the start, only later as things clarify do I convert them to classes and templates as needed; I use CamelCaseNames names for public properties and lower_case_with_underscores for private ones - I find for me this works better than any other standards-scheme I've encountered, and I try to let the names be 'documentation' as well; also differentiation between methods and attributes is a gray area, especially with the up-comming dot-operator (operator.()) which is going to cause all kinds of havoc...
-
Attachment: TreeGrid.zip
(Size: 15.37KB, Downloaded 259 times)
|
|
|
|
|
|
|
Re: TreeGrid Control - Update 6 [message #45850 is a reply to message #45847] |
Wed, 13 January 2016 13:23   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
hi koldo
I spotted one error: Cell::operator=(..) - return-type should be void not Cell&
Did you do a global replace of size_t with int? Why? I'm a bit baffled by this. I know that I sometimes rely on size_t being always >= 0 ... can't remember if I do in this code, more likely than not.
<s>I do use STL quite a lot - mainly because I know it well enough and also because I write modules that I can re-use in non-Upp apps/environments. For the treegrid-package I removed those modules, but you'll find some of them in the sfm-package as an example. As for Upp::String, Upp::Vector, Upp::others.. I'm fine with using them in Upp-UI-environment, but elsewhere?-the jury is still out on that. (on this topic: I normally delete the line "using namespace Upp;" and use Upp::.. - it is the better/conventional practice and it gives back those nice names Upp has used )</s>
edit:
needed to write a custom editor & had to use unicode extensively, and then I found that the String and LineEdit classes already
does everything I need - having had a look at what is required to implement unicode compliance from scratch I can now
truly appreciate the effort that went into creating these classes - so I guess the jury came back all positive for the Upp::*classes
(also am realizing how mush effort & time I wasted on reinventing stuff)
Will soonish republish the refactored ctrl here
[Updated on: Wed, 01 November 2017 12:07] Report message to a moderator
|
|
|
|
Re: TreeGrid Control - Update 6 [message #46811 is a reply to message #45512] |
Tue, 16 August 2016 09:30  |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
if anyone is looking at the sfm package, just this:
the way to use lambdas as callbacks has changed (for the better!)
on line 697 [dircontent.cpp][void DirContent::OnCustomize(Bar &bar)]
old code:
bar.Add("Expandable nodes first",
Callback(lambda([&]{ custom.exd=EXD_FIRST;
Pan.SelectNTBN('T');
custom.bdirty=true;
TG.ListExpandingNodes(custom.exd);
WhenCustomized(); })));
change this to:
bar.Add("Expandable nodes first", [&]{ custom.exd=EXD_FIRST;
Pan.SelectNTBN('T');
custom.bdirty=true;
TG.ListExpandingNodes(custom.exd);
WhenCustomized(); });
as well as for the other entries below it.
|
|
|
Goto Forum:
Current Time: Sat Apr 19 14:45:05 CEST 2025
Total time taken to generate the page: 0.02192 seconds
|
|
|