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: detecting a change of a search string
GridCtrl: detecting a change of a search string [message #31997] Sat, 16 April 2011 18:30 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I'm trying to use the WhenSearchCursor callback to detect changing of a search string (to recalculate summary value). It works fine in all cases except of one, when a search string gets cleared.

Is there a way to detect this situation?

TIA


Regards,
Novo
Re: GridCtrl: detecting a change of a search string [message #32767 is a reply to message #31997] Tue, 07 June 2011 08:29 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Novo wrote on Sat, 16 April 2011 12:30

I'm trying to use the WhenSearchCursor callback to detect changing of a search string (to recalculate summary value). It works fine in all cases except of one, when a search string gets cleared.

Is there a way to detect this situation?

TIA

You mean WhenSearchCursor is not called in that case (when string gets cleared) ?
Re: GridCtrl: detecting a change of a search string [message #32795 is a reply to message #32767] Fri, 10 June 2011 03:44 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
unodgs wrote on Tue, 07 June 2011 02:29

Novo wrote on Sat, 16 April 2011 12:30

I'm trying to use the WhenSearchCursor callback to detect changing of a search string (to recalculate summary value). It works fine in all cases except of one, when a search string gets cleared.

Is there a way to detect this situation?

TIA

You mean WhenSearchCursor is not called in that case (when string gets cleared) ?


Yes. I also tried to attach a callback directly to the member find, but unfortunately it gets reset when search options are changed.

I also need to handle enter when immediate search is disabled. If I install a handler on find.WhenEnter it also will be reset when search options change.


Regards,
Novo
Re: GridCtrl: detecting a change of a search string [message #32965 is a reply to message #32795] Sun, 26 June 2011 13:11 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

WhenSearchCursor is now called when search string is cleared. Could you explain what you mean by "find.WhenEnter[/b] it also will be reset when search options change"?
Re: GridCtrl: detecting a change of a search string [message #32968 is a reply to message #32965] Sun, 26 June 2011 15:17 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
unodgs wrote on Sun, 26 June 2011 07:11

Could you explain what you mean by "find.WhenEnter it also will be reset when search options change"?


void GridCtrl::SetFindOpts(int n)
{
	switch(n)
	{
		case 0:
			search_immediate = !search_immediate;
			if(!search_immediate)
			{
				find <<= THISBACK(Nothing);
				find.WhenEnter = THISBACK(DoFind);
			}
			else
			{
				find <<= THISBACK(DoFind);
				find.WhenEnter = THISBACK(Nothing);
			}
			break;
		case 1:
			search_hide = !search_hide;
			if(!String(~find).IsEmpty())
			{
				if(!search_hide)
					ShowRows();
				else
					DoFind();
			}
			break;
		case 2:
			search_highlight = !search_highlight;
			if(!search_highlight)
			{
				ClearFound(false);
				Refresh();
			}
			else
				DoFind();
			break;
		case 3:
			search_case = !search_case;
			DoFind();
			break;
	}
}


GridCtrl::SetFindOpts() resets find.WhenEnter and find.WhenAction when search_immediate option is changed. Sorry, it is just one option.

I believe member find was made public by mistake.


Regards,
Novo
Previous Topic: Simpler way to access Option in GridCtrl
Next Topic: GridCtrl paste and WhenAction
Goto Forum:
  


Current Time: Thu Mar 28 12:31:17 CET 2024

Total time taken to generate the page: 0.01073 seconds