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 » CalendarCtrl » switch date format
Re: switch date format [message #24266 is a reply to message #24261] Fri, 08 January 2010 10:29 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Ah, I see. I was confused by your initial post.

There isn't really any mechanism for the sort of singnal you're proposing, but there is another solution:

void CtrlLibTest::SetFormat()
{
	static bool toggle = false;
	Backup();
	if(toggle)
	{
		SetDateScan("mdy");
		SetLanguage( LNG_( 'E', 'N', 'G', 'B' ) );
		SetDateFormat("%2:02d/%3:02d/%1:4d");
	}
	else
	{
		SetDateScan("dmy");
		SetLanguage( LNG_( 'D', 'E', 'D', 'E' ) );
		SetDateFormat("%3:02d/%2:02d/%1:4d");
	}
	Restore();
	toggle = !toggle;
}

- Backup serializes the values from the EditFields on the window
- the date format is changed
- Serialize again to restore the data
This makes the EditField re-format it's value and you get the correct result.

In practice you probably don't want to use Backup and Restore as this may interfere with other functions (like cancelling), but what they do is very simple and easy to reproduce. It's only using StringStreams.

If you want to apply this effect globally you could iterate through all the windows using GetTopWindows, or send your own signal to tell windows to do it themselves.

If you really want to send a signal straight to the DateTimeCtrl you'd have to make a derived class and send your own signal.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Min and Max in DropTime
Next Topic: StrToDate(Date& d, const char *s, Date def)
Goto Forum:
  


Current Time: Sat Sep 06 00:08:07 CEST 2025

Total time taken to generate the page: 0.05608 seconds