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 » DoSum(), DoAvg(), etc... and search operations
DoSum(), DoAvg(), etc... and search operations [message #23382] Thu, 15 October 2009 17:13 Go to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Hello,

I use to define WhenUpdateSummary and did my own suming but when searching to fix my problem I found DoSum(), DoAvg(), etc... I now use that, much easier!

Anyway, my root problem/desire is to change the summary when the person begins to search. I noticed that when I had my own WhenUpdateSummary defined, that it was called each time the search was revised, which is good but I could not figure out how to tell if a given row was displayed in the search results or hidden from the search results.

I then found DoSum() and friends hoping that it would handle it interally but it does not seem to pay attention to the items displayed status either.

So, my question is, how can I make the summary display only what is shown not other items that are hidden due to a search. Now, the idea is also that if there is no active search than the whole grid would be summed of course. I'd like to be able to do this with the build in DoSum and friend functions but will use a WithUpdateSummary event function if necessary.

Thanks,

Jeremy
Re: DoSum(), DoAvg(), etc... and search operations [message #23388 is a reply to message #23382] Thu, 15 October 2009 22:45 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

To check is a given row is displayed or not use this code:
grid.GetRow(n).IsHidden();

To check if row matches a search pattern:
grid.GetRow(n).IsFound();

As for DoSum() etc - it's fixed now, it sums only visible rows. Patch will be available tomorrow together with sorting fix.
Re: DoSum(), DoAvg(), etc... and search operations [message #23389 is a reply to message #23388] Thu, 15 October 2009 22:58 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
I did try the IsFound() and IsHidden() when I saw them in GridCtrl source, however, I quickly found out they are private members?

if (log.GetRow(row).IsFound())

Output:

C:\Development\Projects\UppApps\FlightWise\FlightWise.cpp(73) : error C2248: 'Upp::GridCtrl::ItemRect::IsFound' : cannot access private member declared i
	n class 'Upp::GridCtrl::ItemRect'
        C:\Development\Tools\upp.svn\uppsrc\GridCtrl/GridCtrl.h(584) : see declaration of 'Upp::GridCtrl::ItemRect::IsFound'
        C:\Development\Tools\upp.svn\uppsrc\GridCtrl/GridCtrl.h(453) : see declaration of 'Upp::GridCtrl::ItemRect'


Jeremy
Re: DoSum(), DoAvg(), etc... and search operations [message #23390 is a reply to message #23388] Thu, 15 October 2009 23:15 Go to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Also, on the DoMin() and DoMax() type functions, can this be added to GridCtrl.cpp around line 4627 (SyncSummary function)? It allows the DoMin() and DoMax() summary options to work on Dates.

					else if (IsDateTime(v))
					{
						switch(sop)
						{
							case SOP_MIN:
								if (((Date) v) < ((Date) t))
									t = v;
								break;
							case SOP_MAX:
								if (((Date) v) > ((Date) t))
									t = v;
								break;
							case SOP_SUM:
							case SOP_AVG:
								t = v;
								break;
						}
					}


Jeremy

[Updated on: Thu, 15 October 2009 23:17]

Report message to a moderator

Previous Topic: GridCtrl: Adding column dynamically – How to make editable
Next Topic: Doing my own thing with the ADD button on GridCtrl?
Goto Forum:
  


Current Time: Fri Apr 19 11:51:48 CEST 2024

Total time taken to generate the page: 0.03705 seconds