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 » 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 #45827 is a reply to message #45805] Mon, 11 January 2016 10:10 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
hi koldo

I attach TreegridDemo which I think fits Upp-standards ...
If you think it is worthy you can add it either to Bazaar or include it in your Controls4U-package, and point to me for any queries & bugs. Had a look at your post re uploading to Bazaar with svn & getting permission & etc and saw much hassle and that you are the boffin, so I make it your decision Smile

The sfm-package is purely intended as another demo (Linux-only) and if someone wants to play on with it, I wish them well & have fun.

Re: TreeGrid Control - Update 6 [message #45833 is a reply to message #45827] Mon, 11 January 2016 15:08 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3375
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 Go to previous messageGo to next message
slashupp is currently offline  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 219 times)
Re: TreeGrid Control - Update 6 [message #45838 is a reply to message #45837] Tue, 12 January 2016 08:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3375
Registered: August 2008
Senior Veteran
Hello slashupp

I meant that there is a TreeGridDemo package and a TreeGrid package and I needed both. Now they are Smile

About coding style standards, I do not remember if there is a manual, but however U++ code looks pretty similar even in packages done by different people. You can just open any package and compare it with your coding way.

I will remove all warnings and errors in Windows (3 errors with MinGW, 3 errors (different) and 26 warnings with MSC) and restyle your sources (I promise not to be very aggressive), but only if you are going to accept the majority of changes Rolling Eyes as it will require me hours of work.


Best regards
Iñaki
Re: TreeGrid Control - Update 6 [message #45839 is a reply to message #45838] Tue, 12 January 2016 10:48 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 266
Registered: March 2010
Experienced Member
Ultimate++ code style:
http://www.ultimatepp.org/www$uppweb$codestyle$en-us.html


regards
omari.
Re: TreeGrid Control - Update 6 [message #45845 is a reply to message #45512] Tue, 12 January 2016 16:48 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member

Hi koldo

omari posted a link (thanks) I recognized it when I opened it, seen before but forgotten
I'll use that as basis to fixing up my code to upp-standards or at least reduce conflicts.

Please post the errors (both MingW & Windows) and all the warnings from Windows.

(I've tested it in Wine with MingW and it compiled clean)

thx for your input & patience
Re: TreeGrid Control - Update 6 [message #45847 is a reply to message #45845] Wed, 13 January 2016 08:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3375
Registered: August 2008
Senior Veteran
Hello slashupp

I posted some of the errors some posts before. It is more difficult to explain them than solving it, as there are many things to change. Here I enclose the new files. Please check the differences.

Coding style is different from what I am used, and std:: is used a lot.
  • Attachment: TreeGrid.7z
    (Size: 16.58KB, Downloaded 209 times)


Best regards
Iñaki
Re: TreeGrid Control - Update 6 [message #45850 is a reply to message #45847] Wed, 13 January 2016 13:23 Go to previous messageGo to next message
slashupp is currently offline  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 Smile )</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 #45861 is a reply to message #45850] Thu, 14 January 2016 08:30 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3375
Registered: August 2008
Senior Veteran
Hello slashupp

The problem is that U++ uses int instead of size_t to index arrays, so your code generated many warnings in many different places. Initially I went fixing it carefully but after I while, I finished removing all size_t.

Please check other error (like the use of va_start and functions without return).


Best regards
Iñaki
Re: TreeGrid Control - Update 6 [message #46811 is a reply to message #45512] Tue, 16 August 2016 09:30 Go to previous message
slashupp is currently offline  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.

Previous Topic: с++ low-level
Next Topic: simmxtools v0.1
Goto Forum:
  


Current Time: Sun Jun 23 17:44:02 CEST 2024

Total time taken to generate the page: 0.01734 seconds