U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » CalendarCtrl » DateTimeCtrl 1.06 released
DateTimeCtrl 1.06 released [message #4553] Tue, 15 August 2006 10:47 Go to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Hi!

I developed new version of datetime ctrl. Please use it and report any bug. This version brings two importnat features: Scalability with system font size and calendar as a separate control:

index.php?t=getfile&id=201&private=0

Sources: http://dgs.pac.pl/dgs.php?page=downloads

Changelog:
- fixed crash introduced in 1.05
* DateTimePopUp class renamed to Calendar
+ calendar scales properly with used font's size
+ calendar can be now used as a separate control
+ highlighting if header date is pointed
* SetSize() method removed
* SetBorderSize() method removed
* Select All days is now default
* calendar use colors appropriate to selected gui theme
* other various fixes and improvements

PS: Mirek it seems that tips on popup windows stopped to work again..
PS2: h3l1 - I also included your translations
  • Attachment: dt_1.06.png
    (Size: 31.54KB, Downloaded 4312 times)
Re: DateTimeCtrl 1.06 released [message #4570 is a reply to message #4553] Tue, 15 August 2006 18:40 Go to previous messageGo to next message
rbmatt is currently offline  rbmatt
Messages: 90
Registered: July 2006
Location: Tennesse, USA
Member
Works great in my application. Thanks!
Re: DateTimeCtrl 1.06 released [message #4578 is a reply to message #4570] Tue, 15 August 2006 22:09 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

rbmatt wrote on Tue, 15 August 2006 12:40

Works great in my application. Thanks!

Good to hear that Smile
Re: DateTimeCtrl 1.06 released [message #4579 is a reply to message #4553] Tue, 15 August 2006 22:12 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
Excellent work!

Might I nonetheless suggest to add an option which takes the "1st calendar week problem" into account?

There are three different ways to number the weeks of a year:

1.
The 1st week is the week containing January, 1.
This is the Microsoft Excel version.

2.
The 1st week is the 1st complete week of the year (rising the problem of the first day of the week: Sunday or Monday).

3.
The 1st week is the week containing at least four days of the new year.
This is ISO 8601.

Werner
Re: DateTimeCtrl 1.06 released [message #4580 is a reply to message #4579] Tue, 15 August 2006 22:37 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Yes you're right. I just used method appropriate for europe (I think so, I'm not an expert in this topic...).
The only problem is to find proper algorithms for method:

WeekOfYear(int day, int month, int year)

if you know them please mail them to me.

I will also add ability to choose what day of week is first monday or sunday - in one of next versions..
Re: DateTimeCtrl 1.06 released [message #4584 is a reply to message #4580] Tue, 15 August 2006 23:20 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
unodgs wrote on Tue, 15 August 2006 22:37

Yes you're right. I just used method appropriate for europe (I think so, I'm not an expert in this topic...).
The only problem is to find proper algorithms for method:

WeekOfYear(int day, int month, int year)

if you know them please mail them to me.

I will also add ability to choose what day of week is first monday or sunday - in one of next versions..


I'll look around. In a rush I only found the following spreadsheet formula to calculate the week of a year from a date in cell A1 according to ISO 8601:

TRUNCATE((A1-DATE(YEAR(A1-REST(A1-2;7)+3);1;REST(A1-2;7)-9)) /7)

(I hope this is clear. I had to translate the formula from German to English. And I even didn't test it Rolling Eyes )

Werner

Re: DateTimeCtrl 1.06 released [message #4599 is a reply to message #4553] Wed, 16 August 2006 10:17 Go to previous messageGo to next message
h3l1 is currently offline  h3l1
Messages: 28
Registered: August 2006
Location: Innsbruck, Austria
Promising Member
Hi,

cool work! Thanks alot Cool
Re: DateTimeCtrl 1.06 released [message #4614 is a reply to message #4580] Wed, 16 August 2006 21:48 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
unodgs wrote on Tue, 15 August 2006 22:37

Yes you're right. I just used method appropriate for europe (I think so, I'm not an expert in this topic...).
The only problem is to find proper algorithms for method:

WeekOfYear(int day, int month, int year)

if you know them please mail them to me.

I will also add ability to choose what day of week is first monday or sunday - in one of next versions..


The following link is not exactly what I was looking for - it's C# ... Crying or Very Sad

Anyway I could imagine that it might prove quite useful Very Happy :

http://www.codeproject.com/cs/miscctrl/MonthCalendar.asp

As soon as I find something in C or C++ I'll let you know.

Werner
Re: DateTimeCtrl 1.06 released [message #4615 is a reply to message #4614] Wed, 16 August 2006 22:42 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Werner wrote on Wed, 16 August 2006 15:48


The following link is not exactly what I was looking for - it's C# ... Crying or Very Sad

Anyway I could imagine that it might prove quite useful Very Happy :

http://www.codeproject.com/cs/miscctrl/MonthCalendar.asp

As soon as I find something in C or C++ I'll let you know.



Thanks! Unfortunately this calendar calculates week number using ISO8601 method which is already implemented in datetimectrl...

PS: Do we really need another method of week calculation??
Re: DateTimeCtrl 1.06 released [message #4638 is a reply to message #4615] Thu, 17 August 2006 18:24 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member

Quote:

Thanks! Unfortunately this calendar calculates week number using ISO8601 method which is already implemented in datetimectrl...

PS: Do we really need another method of week calculation??


I strongly believe so!

Please refer to http://en.wikipedia.org/wiki/Week "Week number". You can read there that at least the US uses a system different from ISO 8601. I can't imagine that a library which doesn't consider US customs will be successful - be this desirable or not.

And even more compelling: http://www.merlyn.demon.co.uk/weekinfo.htm. I only now learned that there are UK and US tax weeks. While writing an application to calculate taxes may not be the everyday job of an ordinary programmer, this is definitely a typical computer task. Providing a flexible week-of-the-year feature would be a nice unique "selling" point of Ultimate++.

Or am I too demanding?

Werner

[Updated on: Thu, 17 August 2006 21:35]

Report message to a moderator

Re: DateTimeCtrl 1.06 released [message #4642 is a reply to message #4638] Thu, 17 August 2006 18:49 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
I need flexible switching of weeks, too.
Re: DateTimeCtrl 1.06 released [message #4643 is a reply to message #4638] Thu, 17 August 2006 18:58 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Quote:

Or am I to demanding?

Of course not. It's an easy task - just need to find algorithm. I always been week in dates calculations - that's why I'm looking for solution out of box.
Re: DateTimeCtrl 1.06 released [message #4910 is a reply to message #4553] Thu, 24 August 2006 22:29 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
I compiled your DateTimeCtrl package and it works fine after removing reference on String in line 473 in DateTimeCtrl.cpp. I compiled with version 608.r21.
By the way, I had to change the image file location #define and the layout file location #define from relative to absolute spec, because they could not be found. Is this normal or does this effect only exist due to the fact that I have the DateTimeCtrl package in a totally different directory tree as the upp sources?

Matthias


931b81e7ea53320dccc37375b34b38c3
Re: DateTimeCtrl 1.06 released [message #4912 is a reply to message #4910] Thu, 24 August 2006 23:35 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

masu wrote on Thu, 24 August 2006 16:29

I compiled your DateTimeCtrl package and it works fine after removing reference on String in line 473 in DateTimeCtrl.cpp. I compiled with version 608.r21.
By the way, I had to change the image file location #define and the layout file location #define from relative to absolute spec, because they could not be found. Is this normal or does this effect only exist due to the fact that I have the DateTimeCtrl package in a totally different directory tree as the upp sources?

Matthias


I'm sorry for any trouble. Yesterday I did many fixes due to gcc and linux compatibility (including that ones you're describing). When I also add ability to choose first day of week I will release 1.07
Re: DateTimeCtrl 1.06 released [message #4923 is a reply to message #4912] Fri, 25 August 2006 11:12 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
unodgs wrote on Thu, 24 August 2006 23:35

I'm sorry for any trouble. ...



No problem at all, thank you for the great control Smile.
I just wanted to let you know about the issues.

Matthias

Re: DateTimeCtrl 1.06 released [message #5411 is a reply to message #4923] Wed, 20 September 2006 00:51 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 702
Registered: December 2005
Location: Budapest, Hungary
Contributor
I have found a small bug. In ReadOnly mode, user can click on drop button, dropping the calendar.
I added a line to void DateTimeCtrl::OnDrop() method as first line:
if(!IsEditable()) return;

Now it works perfectly. Btw thanks for this good work Smile
Re: DateTimeCtrl 1.06 released [message #5412 is a reply to message #5411] Wed, 20 September 2006 08:35 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

zsolt wrote on Tue, 19 September 2006 18:51

I have found a small bug. In ReadOnly mode, user can click on drop button, dropping the calendar.
I added a line to void DateTimeCtrl::OnDrop() method as first line:
if(!IsEditable()) return;

Now it works perfectly. Btw thanks for this good work Smile

Thanks! Your fix will be added to the next version 1.07.
Re: DateTimeCtrl 1.06 released [message #6275 is a reply to message #5412] Sun, 05 November 2006 14:51 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
found a small "bug"

when clicking on today but you are in another month or year the calendar won't change to todays month and year:
changed Calendar::LeftDown(Point p, dword keyfile)
[...]
if(aspopup) {
[...] 
} else {
   [...]
   RefreshDay(prevday);
   if(istoday)
      SetDate(dt); //this line was changed
   else if()
      [...]
}


Bas

[Updated on: Sun, 05 November 2006 14:52]

Report message to a moderator

Re: DateTimeCtrl 1.06 released [message #6277 is a reply to message #6275] Sun, 05 November 2006 15:21 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Thanks! You're right. I merged your patch with my sources.
Re: DateTimeCtrl 1.06 released [message #6295 is a reply to message #6277] Sun, 05 November 2006 23:02 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
you are welcome,

another "bug" when compiling with 610-dev4:
since 610-dev3 the function "IsXpStyle()" is gone, so the following line in
DateTimeCtrl.icpp should be changed:
void Calendar::PopUp(Ctrl *owner, Rect &rt) {
   Close();
   Reset();
   
   SetRect(rt);
   //Ctrl::PopUp(owner,true,true,IsXpStyle()); I am old!
   Ctrl::PopUp(owner);
   open=true;
}


Bas

[Updated on: Sun, 05 November 2006 23:02]

Report message to a moderator

Re: DateTimeCtrl 1.06 released [message #6297 is a reply to message #6295] Sun, 05 November 2006 23:27 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

fallingdutch wrote on Sun, 05 November 2006 17:02

you are welcome,

another "bug" when compiling with 610-dev4:
since 610-dev3 the function "IsXpStyle()" is gone, so the following line in
DateTimeCtrl.icpp should be changed:
void Calendar::PopUp(Ctrl *owner, Rect &rt) {
   Close();
   Reset();
   
   SetRect(rt);
   //Ctrl::PopUp(owner,true,true,IsXpStyle()); I am old!
   Ctrl::PopUp(owner);
   open=true;
}


Bas

Thanks again, but this is already fixed. DateTime will be integrated with upp so in future such bugs will be fixed immediately. Sorry for troubles...

Re: DateTimeCtrl 1.06 released [message #6298 is a reply to message #6297] Sun, 05 November 2006 23:58 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 702
Registered: December 2005
Location: Budapest, Hungary
Contributor
This would be better, I think:
void Calendar::PopUp(Ctrl *owner, Rect &rt)
{
	Close();
	Reset();
	
	SetRect(rt);
	//Ctrl::PopUp(owner, true, true, IsXPStyle());
	Ctrl::PopUp(owner, true, true, GUI_GlobalStyle() >= GUISTYLE_XP);
	open = true;
}
Re: DateTimeCtrl 1.06 released [message #6299 is a reply to message #6298] Mon, 06 November 2006 00:14 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

zsolt wrote on Sun, 05 November 2006 17:58

This would be better, I think:
void Calendar::PopUp(Ctrl *owner, Rect &rt)
{
	Close();
	Reset();
	
	SetRect(rt);
	//Ctrl::PopUp(owner, true, true, IsXPStyle());
	Ctrl::PopUp(owner, true, true, GUI_GlobalStyle() >= GUISTYLE_XP);
	open = true;
}


And this's exactely how it's really fixed Wink
Re: DateTimeCtrl 1.06 released [message #6340 is a reply to message #6299] Tue, 07 November 2006 11:52 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
just found another two things:

1. in DateTimeCtrl.cpp you define your IMAGEFILE local, that doesn't work for me, but "#define IMAGEFILE <DateTimeCtrl/DateTimeCtrl.iml>" does work

2. in Paint i get an Error on the line
String &s = DyName((i+1)%7);

it works with
String s = DyName((i+1)%7);


Bas
Re: DateTimeCtrl 1.06 released [message #6342 is a reply to message #6340] Tue, 07 November 2006 11:59 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

fallingdutch wrote on Tue, 07 November 2006 05:52

just found another two things:

1. in DateTimeCtrl.cpp you define your IMAGEFILE local, that doesn't work for me, but "#define IMAGEFILE <DateTimeCtrl/DateTimeCtrl.iml>" does work

2. in Paint i get an Error on the line
String &s = DyName((i+1)%7);

it works with
String s = DyName((i+1)%7);


Bas


Thanks! But I think I have this all already fixed (I did it when testing it under linux and using gcc).
Re: DateTimeCtrl 1.06 released [message #6575 is a reply to message #6342] Sun, 19 November 2006 14:04 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
a callback when the selected day changed would be nice, so you can react on it by getting the current date and run some other code with the new date.

Bas

[Updated on: Sun, 19 November 2006 14:06]

Report message to a moderator

Re: DateTimeCtrl 1.06 released [message #6581 is a reply to message #6575] Sun, 19 November 2006 15:57 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

fallingdutch wrote on Sun, 19 November 2006 08:04

a callback when the selected day changed would be nice, so you can react on it by getting the current date and run some other code with the new date.

Bas


I think WhenAction is all you need...

datectrl <<= THISBACK(WhenDateChanges);
or

datectrl.WhenAction = THISBACK(WhenDateChanges);
Re: DateTimeCtrl 1.06 released [message #6584 is a reply to message #6581] Sun, 19 November 2006 16:48 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
with a little change, yes:

i am only using Calendar, not DateTimeCtrl.

so I Added Action() to the else part of if(aspopup) in LeftDown(Point p, dword flags) after the three lines updating the current day, month and year.

void Calendar::LeftDown(Point p, dword flags) {
   [...]
   if(aspopup) {
      [...]
   } else {
      cday = dt.day;
      cmonth = dt.month;
      cyear = dt.year;

      Action();

      [...]
   }
}


Bas
Re: DateTimeCtrl 1.06 released [message #6585 is a reply to message #6584] Sun, 19 November 2006 17:07 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Yes, you're right, I thought you meant datetimectrl not the calendar.
I think there should be WhenAction() instead of your own callback Action.
Re: DateTimeCtrl 1.06 released [message #6586 is a reply to message #6585] Sun, 19 November 2006 17:45 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
Action() calls the WhenAction callback

Bas
Re: DateTimeCtrl 1.06 released [message #6587 is a reply to message #6586] Sun, 19 November 2006 18:12 Go to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

fallingdutch wrote on Sun, 19 November 2006 11:45

Action() calls the WhenAction callback
Bas

There is always something to learn about upp Wink
Previous Topic: [EXISTS] DateTimeCtrl
Next Topic: DateTimeCtrl in new versions U++
Goto Forum:
  


Current Time: Wed Apr 29 12:41:08 GMT+2 2026

Total time taken to generate the page: 0.01565 seconds