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  |
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.
|
|
|
Goto Forum:
Current Time: Fri Sep 05 21:18:00 CEST 2025
Total time taken to generate the page: 0.06008 seconds
|