Recent

Author Topic: Questions about a new Calendar component.  (Read 71536 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #15 on: June 13, 2013, 10:58:06 am »
You couldn't be more right about the benefits of having a global community :)

There is a Jewish Calendar that is lunar based, but it's a computational nightmare.  But Israelis live in a secular world so for business and other reasons we generally use the secular calendar except for Jewish events.  It gets even more confusing for the uninitiated when they find out our new day begins at sundown instead of midnight (biblically based).  I can usually see sundown but I have never seen midnight.

My first experiment with your CalendarLite is to build a full year calendar with 12 months.  I'm really impressed with how easy and flexible it is.  Seriously, you should submit this to Lazarus as a new component.
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #16 on: June 13, 2013, 01:20:09 pm »
I'm almost finished with my Year Calendar experiment.  All it need now is the Arrows to jump Forward/Back a year. 
 
Lazarus Trunk / fpc 2.6.2 / Win32

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Questions about a new Calendar component.
« Reply #17 on: June 13, 2013, 02:13:50 pm »
If a property were introduced to make the DayName row display optional, day names could be shown on the first three months, and be turned off for the other 9 months (where they are redundant) and thereby save a bit of screen space. What do you think? Is it worth the effort?

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #18 on: June 13, 2013, 02:31:22 pm »
Personally even if you could turn off the DayNames, I would probably still show them.  My eyesight isn't so good.  But having it as an option might be nice. 

I don't know if you noticed that the Top Line of TCalendarLite with the Month and Year is not showing in my experiment.  In my opinion it would be good if that line were optional.

One thing I did notice though was the absence of a GoToToday feature.  Or maybe it's there I overlooked it.  It's easy to do it with code like "OnLabel1.Click - Date:= Now" but when I tried that the Red Rectangle disappeared as well.
Lazarus Trunk / fpc 2.6.2 / Win32

wp

  • Hero Member
  • *****
  • Posts: 12622
Re: Questions about a new Calendar component.
« Reply #19 on: June 13, 2013, 05:24:31 pm »
I think this is an interesting component, and I decided to add some properties which I think might be useful:
  • highlight weekend days by different color and/or bold font
  • highlight holidays by different color and/or bold font; the holidays are passed to the component by means of the event OnGetHolidays
  • combine boolean properties into a property "Options" to shorten the object inspector list
      TCalOption = (coShowToday, coShowBorder, coShowWeekend, coBoldWeekend,
        coShowHolidays, coBoldHolidays, coBoldDayNames, coBoldTopRow);
  • combine color properties into a property "Colors" to shorten the object inspector list.
         property BackgroundColor: TColor index 0 read GetColor write SetColor default clWhite;
        property BorderColor: TColor index 1 read GetColor write SetColor default clSilver;
        property PastMonthColor: TColor index 2 read GetColor write SetColor default clSilver;
        property SelectedDateColor: TColor index 3 read GetColor write SetColor default clMoneyGreen;
        property WeekendColor: TColor index 4 read GetColor write SetColor default clRed;
        property HolidayColor: TColor index 5 read GetColor write SetColor default clRed;
        property TextColor: TColor index 6 read GetColor write SetColor default clBlack;
        property ArrowColor: TColor index 7 read GetColor write SetColor default clSilver;
        property ArrowBorderColor: TColor index 8 read GetColor write SetColor default clSilver;

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #20 on: June 13, 2013, 09:05:53 pm »
Nice work wp :)  In one day you guys have created a Calendar that is so far beyond TCalendar that I can't believe anyone would use TCalendar again.  I think I can safely predict that it will eventually become a TDBCalLite component and the special highlighting will really come in handy for appointments and whatever.
« Last Edit: June 13, 2013, 09:47:07 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: Questions about a new Calendar component.
« Reply #21 on: June 13, 2013, 09:25:38 pm »
Very nice looking component.
Seems to be a little update problem when clicking on days in the next month.
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Questions about a new Calendar component.
« Reply #22 on: June 13, 2013, 09:38:19 pm »
Superb enhancements, wp, crafted so concisely.
Thinking about your preference, Avishai, makes me wonder if it might be better to have a top row of date-changing arrows including a Today panel (clickable to go to today), and perhaps at the bottom have an (optional) current long month + year display.
Also whether we should put this somewhere on CCR so there is a central repository where collaboration can proceed without the need to continually transfer .zip files and update. Do you know how to go about this?
@eny: Sharing code shows up bugs much faster than testing oneself! Actually if anyone has any tips on how to write unit tests for GUI components, it would be good to share them. I'm not sure how to go about that in a systematic way, but I think the more complex a component gets the more important it becomes to have a few basic tests that check if anything gets broken by some fresh enhancement. Or with GUI stuff does it always come down to visual inspection of the outcome?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Questions about a new Calendar component.
« Reply #23 on: June 13, 2013, 09:50:20 pm »
If you are looking for enhancements there are a couple that come to mind.
One easy is to create a pop menu with all the month names and show it when some one clicks on the month name on the calendar to quickly choose any month s/he wants.
same idea for the year but since the year is not finite a list box should be shown with around 20 years -10..+10 for fast selection.
Something along the lines of  themes for the calendar it self or theme support for the underline widgetset eg windows7 or gtk active theme colors and fonts.

There are a tone of things to do eg double clicking on the year show a TSpinedit to key in the year etc.
Most important though is the support of the underline widgetset colors and fonts. I might try to implement it my self later tonight.

PS. Great work guys hopefully it will be added to ccr as well. Thanks for the fish.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1255
Re: Questions about a new Calendar component.
« Reply #24 on: June 14, 2013, 05:13:29 am »
hello everybody,
if you want to play with the component, i have created a package lzcalendarlite.lpk from the last files posted here. the package can install the component TcalendarLite in the component tab  "example". Just a starting point (original file not modified except register procedure) : it seems that some properties are not published , the colors property is greyed, on Ubuntu 12.04 64 bits when i put the component on a form  sometime there is an added arrow on the component. Enjoy

Friendly, J.P
« Last Edit: June 14, 2013, 05:29:45 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #25 on: June 14, 2013, 06:37:49 am »
I added a line in TCalDrawer.DrawTopRow to fix the display of RightToLeft Month/Day.

Code: [Select]
procedure TCalDrawer.DrawTopRow;
var r: TRect;
    s: string;
begin
  if (FCanvas.Font.Color <> FOwner.Colors.TextColor) then
    FCanvas.Font.Color:= FOwner.Colors.TextColor;
  if (coBoldTopRow in FOwner.Options) then
    FCanvas.Font.Style := [fsBold]
  else
    FCanvas.Font.Style := [];
  case FOwner.BiDiMode = bdLeftToRight of
    False: begin
             r:= GetCellAtColRow(7, 1); DrawArrow(r, ahDouble, adLeft);
             r:= GetCellAtColRow(6, 1); DrawArrow(r, ahSingle, adLeft);
             r:= GetCellAtColRow(1, 1); DrawArrow(r, ahDouble, adRight);
             r:= GetCellAtColRow(2, 1); DrawArrow(r, ahSingle, adRight);
             r:= GetCellAtColRow(5, 1);
             s:= IntToStr(FThisYear) + ' ' + FOwner.FMonthNames[FThisMonth];
           end;
    True: begin
            r:= GetCellAtColRow(1, 1); DrawArrow(r, ahDouble, adLeft);
            r:= GetCellAtColRow(2, 1); DrawArrow(r, ahSingle, adLeft);
            r:= GetCellAtColRow(7, 1); DrawArrow(r, ahDouble, adRight);
            r:= GetCellAtColRow(6, 1); DrawArrow(r, ahSingle, adRight);
            r:= GetCellAtColRow(3, 1);
            s:= FOwner.FMonthNames[FThisMonth] + ' ' + IntToStr(FThisYear);
          end;
  end;
  s:= FOwner.FMonthNames[FThisMonth] + ' ' + IntToStr(FThisYear);  //<<< Added by Avishai
  FCanvas.TextRect(r, 0, 0, s, FTStyle);
end;
Lazarus Trunk / fpc 2.6.2 / Win32

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Questions about a new Calendar component.
« Reply #26 on: June 14, 2013, 08:35:21 am »
@JurassicPork
I prefer to keep newly developed components off the Palette until they have been well tested and debugged (and this one certainly hasn't been so far - even the desired properties and features are still undecided). It is possible that installing a buggy component might destabilise the IDE. OK, unlikely in this case of a display-only widget, but certainly not impossible.
There is also the question of testing a new component in the Designer, which may show up unforeseen problems (because the Designer is quite complex software), and to interact with the Object Inspector may need new property editors to be written and tested, etc. So I think it's premature to package it up with a Register procedure. I haven't even attempted to use the component in the Designer yet, it's too soon.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1255
Re: Questions about a new Calendar component.
« Reply #27 on: June 14, 2013, 08:52:59 am »
OK HowardPC , i have just created a package to check the component in the IDE.(not so bad it is usable).  If i can help you for the component , tell me what i can do. 

Friendly, J.P
« Last Edit: June 14, 2013, 08:55:30 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Questions about a new Calendar component.
« Reply #28 on: June 14, 2013, 10:00:58 am »
If i can help you for the component , tell me what i can do. 

Well, if we had property editors for DayNames and MonthNames they could be published properties and appear in the Object Inspector. Are you up for that?

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Questions about a new Calendar component.
« Reply #29 on: June 14, 2013, 06:09:35 pm »
Just to let you know, I finally had the time to log in to my Hebrew user account and check out TCalendarLite.  All I had to do was set BiDiMode:= bdRightToLeft.  The Month and Day Names were already in Hebrew as it should be, and the Calendar worked the same as in my English longin.
Lazarus Trunk / fpc 2.6.2 / Win32

 

TinyPortal © 2005-2018