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 » DropTime problem
Re: DropTime problem [message #19566 is a reply to message #19564] Tue, 16 December 2008 16:02 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Tom1 wrote on Tue, 16 December 2008 17:00

Hi,

Thanks! Now here's a suggestion: Change code in Core/Convert.cpp as follows:

int ConvertTime::Filter(int chr) const
{
	if(IsDigit(chr) || chr == ' ' || chr == '.' || chr == ':')
		return chr;
	if(chr == ',')
		return '.';
	return CharFilterDate(chr);
}


Time is not only hh:mm:ss, but also contains date in some format. I assume the filter should therefore accept the current date filter characters too.

// Tom


Why not use your implementation of DropTime widget ctrl? For example:
class MyConvertTime : public ConvertTime {
public:
	virtual int Filter(int chr) const
	{
		int c = CharFilterDate(chr);

		if (c != 0) return c;
		else return ConvertTime::Filter(chr);
	}
};

typedef EditMinMax<Time, MyConvertTime> MyEditTime;

class MyDropTime : public DateTimeCtrl<MyEditTime> {
public:
	MyDropTime();
	MyDropTime& SetTime(int y, int m, int d, int h, int n, int s);
	MyDropTime& Seconds(bool b = true) { DateTimeCtrl<MyEditTime>::Seconds(b); MyEditTime::Seconds(b); return *this; }
	MyDropTime& NoSeconds() { return Seconds(false); }
};

MyDropTime::MyDropTime() : DateTimeCtrl<MyEditTime>(CalendarClock::MODE_TIME)
{}

MyDropTime& MyDropTime::SetTime(int y, int m, int d, int h, int n, int s)
{
	MyEditTime::SetData(Time(y, m, d, h, n, s));
	return *this;
}

[Updated on: Tue, 16 December 2008 17:46]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New SetDate for DateTimeCtrl
Next Topic: Clock small scale
Goto Forum:
  


Current Time: Tue Aug 26 22:24:07 CEST 2025

Total time taken to generate the page: 0.00774 seconds