Recent

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

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Questions about a new Calendar component.
« Reply #60 on: November 07, 2016, 03:32:15 pm »
I had contacted howardpc before uploading the component and got his permission to do so and to modify the license.
In that case, all is well. ;-)  Thanks for the update.

G.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #61 on: November 10, 2016, 01:54:14 pm »
Is there any documentation available?
Now there's a wiki page explaining everything including some advanced stuff of the new version (http://wiki.lazarus.freepascal.org/CalLite).
New release at https://sourceforge.net/projects/lazarus-ccr/files/CalLite/: Hints, ownerdrawn cells, modifyable day texts.

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #62 on: November 10, 2016, 05:25:53 pm »
I've just installed this package and on first use everything went as expected, fully adjustable size, position, text colour, emboldening etc.

Then I wanted to remove the date display at the bottom (I already have that in my main form). Initially I left 'Holiday....' but that seemed un-necessary (for me) but removing all the text from 'DisplayText' caused Laz to go into a terminal loop with only 'Close the Program' option.

I could recover by a simple restart and left just 'Holiday"","""""" ' which seemed OK.

I then looked at what changes I could make to the other properties, specifically TopLineColour, TopLineText but nothing seemed to change whatever I selected. No matter I thought, compile and see if anything had changed at run-time. YES something had changed - on displaying the calendar I got an error message  "List index (1) out of bounds" with just the top two lines displayed (Month and day names).

Looking at the object inspector again to see what the problem could be meant I had to re-start Laz but this time it went immediately into the terminal loop and now will not open at all  :'(

I've now restarted my system to see if clearing any flags might solve the issue and opened an older project successfully but trying to open my current project which has the Lite Calendar component attached still fails.
« Last Edit: November 10, 2016, 05:39:14 pm by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #63 on: November 10, 2016, 09:35:05 pm »
Could you put all that you did with the calendar into a little project to reproduce the error and upload it here?

In order to remove the "today" line at the bottom you just remove the option opShowTodayRow from the calendar's Options.

How did you get to the 'Holiday...' text? That should not be there at all. You say: "removing all the text from 'DisplayText'" - did you modify the sources of callite? Don't do this unless you know what your are doing. And doing so will leave you with a version that is no longer compatible with the release and all subsequent versions.
 
« Last Edit: November 10, 2016, 09:56:42 pm by wp »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1245
    • formatio reticularis
Re: Questions about a new Calendar component.
« Reply #64 on: November 10, 2016, 09:54:24 pm »
Is there any documentation available?
Now there's a wiki page explaining everything including some advanced stuff of the new version (http://wiki.lazarus.freepascal.org/CalLite).
New release at https://sourceforge.net/projects/lazarus-ccr/files/CalLite/: Hints, ownerdrawn cells, modifyable day texts.

Thanks. This article is very useful.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 3.7.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #65 on: November 11, 2016, 04:05:30 am »
Could you put all that you did with the calendar into a little project to reproduce the error and upload it here?
.ZIP file attached
In order to remove the "today" line at the bottom you just remove the option opShowTodayRow from the calendar's Options.

How did you get to the 'Holiday...' text? That should not be there at all. You say: "removing all the text from 'DisplayText'" -
Because I can no longer get into the project I can't give you a verbatim text that is in the left hand column of the Object Inspector but it was something like 'Display Text..." When I wiped out 'Today is MMM.YY...' the text 'Holiday....... etc appeared in its place I tried removing just a part of that and that's when the problem appeared.

did you modify the sources of callite? Don't do this unless you know what you are doing. And doing so will leave you with a version that is no longer compatible with the release and all subsequent versions.
No  -  I wouldn't even think about LOOKING at the source code. The only interaction I have had is with the Object Inspector and I would expect anything that I could change in there is intended to be changed by the user.

I don't recall seeing a "opShowTodayRow" but of course I hadn't looked at every line in the Ob-Insp I was working my way through the options to understand what adjustments could be made - the ones that interested me most first, such as width, height, font, colour etc.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #66 on: November 11, 2016, 09:22:22 am »
Your zip does not contain the pas and lfm files

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #67 on: November 11, 2016, 10:15:45 am »
I think I added a code-breaking change recently. The DisplayTexts used to be a comma-separated list of texts to be displayed in the bottom line of the calendar. Since having a comma-separator makes it difficult to have a comma inside the text items I had changed the separator to be a bar character (|) unaware that it could break previously created forms. This could have been the root cause of your trouble...

In the current trunk revision, this change is reverted. Try to open your form again after updating to this version. If it still does not yet work, open the lfm file in a text editor (don't use the Lazarus IDE), find the block of properties of the CalendarLite and replace the lines "DayNames", "DisplayTexts", and "MonthNames" by these:
Code: [Select]
    DayNames = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'
    DisplayTexts = '"Today is","mm"","" dd yyyy","Holidays during","There are no holidays set for"'
    MonthNames = 'January,February,March,April,May,June,July,August,September,October,November,December'

Before saving make sure to have a backup copy. The form should open correctly after this modification.

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #68 on: November 11, 2016, 11:43:52 am »
Thanks WP  -  apologies for the omission of the pas and lfm files - I just added all the InvClock files forgetting the Clock_ files  :(

As it happens the .LFM file is 481k so adding that to the .zip made it 293k so would have been rejected as an attachment.
I think I added a code-breaking change recently. ... This could have been the root cause of your trouble...
Yes it seems that way - if you want to see if your code is robust, give it to a numpty to play with :)
The form should open correctly after this modification.
Location in the code easily found, bars replaced with commas and the project now opens in Lazarus  :D  Result!

However  -   there always has to be a 'but'   -   continuing my investigation of the options, I've set the background colour to a 'Buff' (in my project 'White' is transparent) and the arrows to Purple. This shows on the design form but after compilation it is still transparent and the arrows are silver - so I assume the change hasn't been acknowledged.

In case it is relevant, I only show the calendar when requested by a mouse click on a button and I've made sure that the calendar is in 'front' using the Z-order option.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #69 on: November 11, 2016, 12:05:30 pm »
It would be better if I had the compilable sources, there's too much which I don't understand: what is 'Buff'? What about the Z order?

Why is the lfm file so big? It should be only a few KB. Remove images, imagelists etc from the form, they certainly won't cause the issues. Remove the ico and res files from zip, they are not needed. Don't add compiler generated files to the zip. The zip should contain only pas, lfm, lpi and lpr files. Remove irrelevant parts of your application. I don't want to spend hours investigating thousands of lines of foreign code.

Did you try the demo2 which comes with the component? Here you can change almost all properties of the calendar and get an immediate feedback.

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #70 on: November 11, 2016, 01:07:51 pm »
It would be better if I had the compilable sources, there's too much which I don't understand: what is 'Buff'? What about the Z order?
Buff is a colour  -  you might call Khaki  -  $007CA4A5  -   created from the mixer
Z-order - I made sure the calendar was 'on top' in case something else on the form could overwrite it - just being cautious.

Why is the lfm file so big? It should be only a few KB. Remove images, imagelists etc from the form, they certainly won't cause the issues. Remove the ico and res files from zip, they are not needed. Don't add compiler generated files to the zip. The zip should contain only pas, lfm, lpi and lpr files. Remove irrelevant parts of your application. I don't want to spend hours investigating thousands of lines of foreign code.

I have removed the irrelevant files and the .Zip is down to 261kb

I'll need to spend some time stripping out some of the code but still make it compile but I have an appointment that demands my time for the next 4-5 hours. In the mean-time I've attached a screen grab showing both the design form and the running program which may be useful.

It may be that removing the background image will be sufficient - that alone is 211kb - I'll make that the first test when I get back.

Did you try the demo2 which comes with the component? Here you can change almost all properties of the calendar and get an immediate feedback.
Not yet - but I will later -
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #71 on: November 11, 2016, 07:57:30 pm »
Right - I've removed the background image and now the .LFM is 4.8k  and the .ZIP 8kb - without removing any code.

It just looks odd on the screen with 'ghostly' hands floating but at least you can look at the adjustments I've made to the calendar and try to determine why the background and arrow colours don't show at run-time.

At least I assume that you will be able to see the Object Inspector.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #72 on: November 11, 2016, 10:20:21 pm »
Thank you. The Colors property of the CalendarLite was missing the setter declaration. Fixed in trunk.

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: Questions about a new Calendar component.
« Reply #73 on: November 11, 2016, 11:23:41 pm »
Thank you. The Colors property of the CalendarLite was missing the setter declaration. Fixed in trunk.
Good - pleased that there was an issue and that my 'meddling' found it  :)

Do I now have to download another version from 'trunk'?  or will there be a 'release' version in CCR?

Whichever is necessary, do I need to remove the package from the IDE and open it again or would simply replacing V0.2 with the new version sort the problem.

I've seen many references to trunk on the forum and I know it refers to the current 'development' code but I've never needed to look any closer so I'm now in virgin territory!

 
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 12682
Re: Questions about a new Calendar component.
« Reply #74 on: November 11, 2016, 11:45:26 pm »
trunk is not packed into a zip archive. You need an svn client. On Windows TortoiseSVN is very popular and integrates into the Explorer.  Install TortoiseSVN. Right-click on the folder into which you want to download callite trunk (note: it must be empty, so it's best to just rename your old one, in case something goes wrong) and select "SVN Checkout". In the line "URL of repository" enter svn://svn.code.sf.net/p/lazarus-ccr/svn/components/callite/. "OK" downloads the current sources - it may take some time, but only for the first time. If you later want to update your local copy, right-click the CalLite folder again, but now select "SVN Update" and Tortoise will just replace the changed files.

After the initial checkout and after each update (and also if you replace your copy with the files from a new zipped "release" version) you must recompile the package. In "Package" / "Open package file .pk" open the callight package (callight_pkg.lpk). Click compile. In many cases this is enough. But if properties have changed you must click "Use" / "Install" to recompile the IDE. When this is done after some time Lazarus will automatically restart the new IDE.

If you don't want to use SVN you can patch your local copy very easily:

Open CalendarLite.pas, in TCalendarLite find the line "property Colors: TCalColors read FColors". Add a "write FColors;" to it. So, this line should read

Code: Pascal  [Select][+][-]
  1.     property Colors: TCalColors read FColors write FColors;

You must rebuild the IDE (as described above) for this change to be effective.

At the moment there are a few bugs to be fixed. After that I'll upload a new zip file version 0.3 to sourceforge.


 

TinyPortal © 2005-2018