TVPlanit Reboot lazarus / 31-LCL ---------------------------------------------------------------------- JD · 2016-06-30 18:41 Hi there everyone, I just downloaded the lastest svn version of tvplanit and I have to commend wp & DonAlfredo for their good work in making these components usable in Lazarus. @wp a) I want to convert the dialogs (event, resource ) to French. How do I do it? I initially wanted to recreate my own event dialog from scratch but it may be easier to just translate what already exists. b) I want to save the events to a remote PostgreSQL database. Your TVpIniDataStore gives me some ideas because I do not want to replicate the data structure of the Events, Resources, Tasks & Contacts tables on the server. I'll just save the data to JSON strings and send them to the remote server for updating the database. I only need some of the fields in those tables. Can I get away with just creating only the fields I need & letting go of the rest? c) How can I customize the categories for events and give them more meaningful descriptions? d) I want to use it for an employee scheduling app. So I'll need to create a table with employee names in rows and dates in columns, similar to a Gantt chart. I don't think tvplanit can do that but what about exporting the events data to fpspreadsheet? JD ---------------------------------------------------------------------- wp · 2016-06-30 19:21 (a) Translation is done as usual by means of po files, you don't have to touch the provided dialogs. Use poedit to translate the strings in "vpsr.po" (folder "languages") to French and save as "vpsr.fr.po". If you want to share this work upload the translated file here so that I can add it to the library. The demo project (examples/demo) is quite advanced and applies translation as well. The strings of the demo project are translated in the demo.*.po files. (b) Well, the Ini Storage was just an excercise for me to better understand the datastores, it shows that the datastores can be very very simple. For a dedicated database system such as PostgreSQL you better use the SqliteDatastore or ZeosDataastore as a template. I'd guess PostgreSQL could be very similar. Unfortunately I do not have much experience with the big database systems, otherwise I'd already have written more dedicated datastores. You can avoid writing a dedicated datastore by using the FlexDatastore. See the discussion in the other thread until a special example sample is available within the distribution. There is also an SQLDatastore (vpsqlds) which appears to be very general and can be adapted by means of sqldialect units. But I though it would be easier to write dedicated datastores and did not yet look into this in detail. I am not sure about missing fields, probably there will be crashes at least with the dedicated datastores. FlexDatastore might work because there is a separate assignment of database fields to internal fields. Once I'll be through with the debugging (there are still lots of bugs...) I'll have a look at missing fields. I think it shouldn't be too difficult: it would be sufficient to check the existence of fields on TCustomDBDatastore (unit vpdbds) which is the ancestor of all database-related datastores. (c) The datastore has a property CategoryColorMap in which you can define the descriptions and colors of the 10 predefined categories (so far, it is not possible to change this number). Have a look at examples/demo, it customizes the first two categories. (d) No, tvplanit cannot do Gantt charts. But since all data are stored in an ordinary database, nothing prevents you from exporting the data to special Gantt tools or fpspreadsheet. The Sqlite and ZeosDatastore expose the internal datasets as public properties. Maybe I should mention that I have some plans for a Gantt series in TAChart in the future. [EDIT] I forgot to mention that the sqlite3 and zeos datastores are in separate packages, laz_visualplanit_sqlite3.lpk and laz_visualplanit_zeos.lpk because the required database components are not part of the standard Lazarus distribution. ---------------------------------------------------------------------- JD · 2016-06-30 20:10 Quote from: wp on June 30, 2016, 09:21:50 pm(a) Translation is done as usual by means of po files, you don't have to touch the provided dialogs. Use poedit to translate the strings in "vpsr.po" (folder "languages") to French and save as "vpsr.fr.po". If you want to share this work upload the translated file here so that I can add it to the library. The demo project (examples/demo) is quite advanced and applies translation as well. The strings of the demo project are translated in the demo.*.po files. OK. I'll get to work on it. Quote from: wp on June 30, 2016, 09:21:50 pm(b) Well, the Ini Storage was just an excercise for me to better understand the datastores, it shows that the datastores can be very very simple. For a dedicated database system such as PostgreSQL you better use the SqliteDatastore or ZeosDataastore as a template. I'd guess PostgreSQL could be very similar. Unfortunately I do not have much experience with the big database systems, otherwise I'd already have written more dedicated datastores. You can avoid writing a dedicated datastore by using the FlexDatastore. See the discussion in the other thread until a special example sample is available within the distribution. There is also an SQLDatastore (vpsqlds) which appears to be very general and can be adapted by means of sqldialect units. But I though it would be easier to write dedicated datastores and did not yet look into this in detail. I have no SQL on the clients. They are dumb clients. All SQL is server-side so just sending a JSON string is enough. Quote from: wp on June 30, 2016, 09:21:50 pm(c) The datastore has a property CategoryColorMap in which you can define the descriptions and colors of the 10 predefined categories (so far, it is not possible to change this number). Have a look at examples/demo, it customizes the first two categories. I'll give it a look. In addition, I've already seen & tested the Zeos datastore. Great work! One other question, is it possible to have events in colour in the DayView and WeekView components sort of like Google Calendar events? JD ---------------------------------------------------------------------- wp · 2016-06-30 20:28 Quote from: JD on June 30, 2016, 10:10:22 pmOne other question, is it possible to have events in colour in the DayView and WeekView components sort of like Google Calendar events?Not at the moment. Could you post a screenshot? ---------------------------------------------------------------------- JD · 2016-06-30 21:19 Quote from: wp on June 30, 2016, 10:28:49 pmQuote from: JD on June 30, 2016, 10:10:22 pmOne other question, is it possible to have events in colour in the DayView and WeekView components sort of like Google Calendar events?Not at the moment. Could you post a screenshot? I posted a screenshot of EssentialPIM. Google Calendar events are similar  to this. TV Planit events have a colour left border & white content. ---------------------------------------------------------------------- wp · 2016-06-30 21:48 Quote from: JD on June 30, 2016, 11:19:16 pmTV Planit events have a colour left border & white content. No, you can change the background color in the datastore's CategoryColorMap. You can also add an icon there for each category. See screenshot of the "demo" project. These colors, however, are used only in the DayView. The WeekView presents just a list of the events within each day box. I wondered whether it makes sense to have colors here as well - I don't think so. ---------------------------------------------------------------------- wp · 2016-06-30 22:14 Quote from: wp on June 30, 2016, 09:21:50 pmI am not sure about missing fields, probably there will be crashes at least with the dedicated datastores. FlexDatastore might work because there is a separate assignment of database fields to internal fields. Once I'll be through with the debugging (there are still lots of bugs...) I'll have a look at missing fields. I think it shouldn't be too difficult: it would be sufficient to check the existence of fields on TCustomDBDatastore (unit vpdbds) which is the ancestor of all database-related datastores.In the current revision the 10 UserFields can be missing without raising an exception. There is no user- interface for adding any data to them in the dialogs provided either. Other candidates for relaxed field handling would the the 5 Custom fields of the contacts, but they do have an input page in the contact editor form. Maybe I'll do this later. ---------------------------------------------------------------------- JD · 2016-06-30 22:35 Quote from: wp on July 01, 2016, 12:14:43 amQuote from: wp on June 30, 2016, 09:21:50 pmI am not sure about missing fields, probably there will be crashes at least with the dedicated datastores. FlexDatastore might work because there is a separate assignment of database fields to internal fields. Once I'll be through with the debugging (there are still lots of bugs...) I'll have a look at missing fields. I think it shouldn't be too difficult: it would be sufficient to check the existence of fields on TCustomDBDatastore (unit vpdbds) which is the ancestor of all database-related datastores.In the current revision the 10 UserFields can be missing without raising an exception. There is no user-interface for adding any data to them in the dialogs provided either. Other candidates for relaxed field handling would the the 5 Custom fields of the contacts, but they do have an input page in the contact editor form. Maybe I'll do this later. This is exactly what I planned to do because I don't need the UserFields. The demo looks very good. I'll take a closer look at it. By the way, how do I print the DayView, WeekView and MonthView? I remember you said tvplanit's printing facilities are very buggy. Thanks, JD ---------------------------------------------------------------------- wp · 2016-07-01 07:48 Quote from: JD on July 01, 2016, 12:35:52 amhow do I print the DayView, WeekView and MonthView? I remember you said tvplanit's printing facilities are very buggy.A lot of printing-related code was commented in the initial Lazarus port, and the package printer4lazarus was missing. A few days ago I was able to get a print-out, but then postponeed this because I had found severe bugs related to recurring events. Please give me some time. ---------------------------------------------------------------------- JD · 2016-07-01 08:04 Quote from: wp on July 01, 2016, 09:48:58 amQuote from: JD on July 01, 2016, 12:35:52 amhow do I print the DayView, WeekView and MonthView? I remember you said tvplanit's printing facilities are very buggy.Please give me some time. Ok. Thanks a lot for your work. ---------------------------------------------------------------------- xinyiman · 2016-07-01 08:14 Where you download the tvplanit version you are referring to? ---------------------------------------------------------------------- wp · 2016-07-01 08:20 Lazarus CCR. See the link in http://wiki.freepascal.org/Turbopower_Visual_PlanIt. ---------------------------------------------------------------------- JD · 2016-07-01 08:31 Think I found a small bug. In the demo & in my own test program, if I set granularity to 60 minutes and then maximize the window, the DayView vertical scrollbar turns black and unresponsive. Changing granularity to a different value restores things to normal. JD ---------------------------------------------------------------------- xinyiman · 2016-07-01 09:57 I installed tvplanit of lazarus 1.6 on mac osx el capitan. Fill the sample successfully (bufdsdatastore), but if you look at the screens that attach there is some bug in graphics. Can you tell me how to solve? ---------------------------------------------------------------------- wp · 2016-07-01 17:42 Quote from: JD on July 01, 2016, 10:31:00 amThink I found a small bug. In the demo & in my own test program, if I set granularity to 60 minutes and then maximize the window, the DayView vertical scrollbar turns black and unresponsive.Fixed. ---------------------------------------------------------------------- JD · 2016-07-01 17:52 Quote from: wp on July 01, 2016, 07:42:36 pmQuote from: JD on July 01, 2016, 10:31:00 amThink I found a small bug. In the demo & in my own test program, if I set granularity to 60 minutes and then maximize the window, the DayView vertical scrollbar turns black and unresponsive.Fixed. Great thanks. All this must take a lot of your time. Much appreciation. By the way, I'll make a French translation available sometime next week. JD ---------------------------------------------------------------------- wp · 2016-07-01 18:22 Quote from: xinyiman on July 01, 2016, 11:57:03 amI installed tvplanit of lazarus 1.6 on mac osx el capitan. Fill the sample successfully (bufdsdatastore), but if you look at the screens that attach there is some bug in graphics. Can you tell me how to solve? I don't have an explanation for the issue of growing fonts, it does not occur on Windows, and not on Linux. Please try the new revision from ccr trunk. It's just a wild guess... ---------------------------------------------------------------------- wp · 2016-07-01 19:47 To all those using the current development version of tvplanit: Due to occasional, but severe installation issues I reorganized the source code and package files (r4883): The main package laz_visualplanit.lpk is now in the source folderThe zeos package laz_visualplanit_zeos.lpk is now in the folder source/addons/zeosThe sqlite3 package laz_visualplanit_sqlite3.lpk is in source/addons/sqlite3The folder packages does no longer exist.At first you must compile laz_visualplanit, then those of the addons which you need. Finally rebuild the IDE. ---------------------------------------------------------------------- JD · 2016-07-01 20:40 Quote from: wp on July 01, 2016, 09:47:52 pmTo all those using the current development version of tvplanit: Due to occasional, but severe installation issues I reorganized the source code and package files (r4883): The main package laz_visualplanit.lpk is now in the source folderThe zeos package laz_visualplanit_zeos.lpk is now in the folder source/addons/zeosThe sqlite3 package laz_visualplanit_sqlite3.lpk is in source/addons/sqlite3The folder packages does no longer exist.At first you must compile laz_visualplanit, then those of the addons which you need. Finally rebuild the IDE. Just grabbed the svn version. Got the following compilation errors: Compile package laz_visualplanit 1.0.4: Exit code 1, Errors: 3, Warnings: 1 vpdayview.pas(312,15) Warning: An inherited method is hidden by "SetColor(TGraphicsColor);" vpbasepainter.pas(68,3) Error: Identifier not found "OffsetRect" vpbasepainter.pas(70,3) Error: Identifier not found "OffsetRect" vpbasepainter.pas(72,3) Error: Identifier not found "OffsetRect" JD ---------------------------------------------------------------------- wp · 2016-07-01 20:52 You were a bit too fast. Should be fixed in the meantime. As for the warning, I'll address them later... ---------------------------------------------------------------------- JD · 2016-07-01 20:54 Quote from: wp on July 01, 2016, 10:52:08 pmYou were a bit too fast. Should be fixed in the meantime. As for the warning, I'll address them later...   You're right. ---------------------------------------------------------------------- wp · 2016-07-01 20:54 Quote from: wp on July 01, 2016, 08:22:03 pmQuote from: xinyiman on July 01, 2016, 11:57:03 amI installed tvplanit of lazarus 1.6 on mac osx el capitan. Fill the sample successfully (bufdsdatastore), but if you look at the screens that attach there is some bug in graphics. Can you tell me how to solve? I don't have an explanation for the issue of growing fonts, it does not occur on Windows, and not on Linux. Please try the new revision from ccr trunk. It's just a wild guess... I can see the issue now on my Linux VM with gtk2 (the previous test was with qt). [EDIT] ... and was able to fix it. Please test if this solves the issue under OSX as well. ---------------------------------------------------------------------- xinyiman · 2016-07-02 10:50 Quote from: wp on July 01, 2016, 08:22:03 pmQuote from: xinyiman on July 01, 2016, 11:57:03 amI installed tvplanit of lazarus 1.6 on mac osx el capitan. Fill the sample successfully (bufdsdatastore), but if you look at the screens that attach there is some bug in graphics. Can you tell me how to solve? I don't have an explanation for the issue of growing fonts, it does not occur on Windows, and not on Linux. Please try the new revision from ccr trunk. It's just a wild guess... Look, I used the version that you say. Yet the written climb. Also someone explains to me why GetDefaultLang gives me an empty value? ---------------------------------------------------------------------- xinyiman · 2016-07-02 11:11 When on window build demo example: demomain.pas(209,3) Error: Identifier not found "GetLocaleFormatSettingsUTF8" ---------------------------------------------------------------------- wp · 2016-07-02 11:47 The version that I posted this night still had a related issue which now made problems on Windows. The current version should save and restore the font correctly in repeated calls to DrawRotatedText (at least I hope so...). The "GetLocaleFormatSettingsUTF8" compilation error is in one of the revisions, yes, sorry. It happened because Lazarus told me that unit LazUtf8 would already be used, I deleted it, everything compiled fine. But after committing I realized that this was not true. I wonder why Lazarus so often fails to notify me of compilation errors... GetDefaultLang is an empty string to indicate the translation system to use the default language found on this particular system. Only after you specify a special language in SetDefaultLang it will return that new language. I agree, the naming is a bit confusing, indeed. ---------------------------------------------------------------------- JD · 2016-07-02 13:32 @wp I've noticed another bug in the display. The limits of DayView (11pm or 23:00) sometimes are not visible because the the scrollbar does not permit scrolling down there i.e it is not in the visible region of the scrollbar. JD ---------------------------------------------------------------------- wp · 2016-07-02 15:46 I thought I had fixed it yesterday, but you are right, that beast is still there... Please check the current revision, it should work now ---------------------------------------------------------------------- JD · 2016-07-02 16:06 Quote from: wp on July 02, 2016, 05:46:19 pmI thought I had fixed it yesterday, but you are right, that beast is still there... Please check the current revision, it should work now Just updated from SVN. It looks OK for all DayView granularity except for 60 minutes. See attached screenshot. ---------------------------------------------------------------------- wp · 2016-07-02 16:55 Strange, I cannot reproduce this. What is your OS? Using the "demo" project, please give me detailed step-by-step instructions how to get into this situation. EDIT You screenshot does not show the bottom part of the window, it looks as if cropped by an image processing software. Or the TVpDayView component is not aligned within its parent and thus cut off. Do you see the issue with the "demo" project? Here the DayView is client- aligned. ---------------------------------------------------------------------- JD · 2016-07-02 17:57 @wp Sorry about that. You're right. It was masked by my bottom button panel. I'll have to redesign the interface. JD Edit: It occured because the DayView was inside a PageControl. I guess I'll have to get rid of the PageControl. ---------------------------------------------------------------------- wp · 2016-07-02 19:38 In my demo it is inside a tabsheet of a pagecontrol as well. Just set Align to alClient. ---------------------------------------------------------------------- JD · 2016-07-02 19:41 Quote from: wp on July 02, 2016, 09:38:21 pmIn my demo it is inside a tabsheet of a pagecontrol as well. Just set Align to alClient. I know. Same as in my application too, but my application has a bottom button panel that sort of masked the last hour of the day in the DayView. I just removed it and it was OK. ---------------------------------------------------------------------- wp · 2016-07-02 20:04 Just to make sure if this isn't another bug of the tvplanit controls: if the bottom panel is bottom-aligned and the dayView is client- aligned, both within the same tabsheet, then they should be out of their way. ---------------------------------------------------------------------- JD · 2016-07-02 21:13 Quote from: wp on July 02, 2016, 10:04:23 pmJust to make sure if this isn't another bug of the tvplanit controls: if the bottom panel is bottom-aligned and the dayView is client-aligned, both within the same tabsheet, then they should be out of their way. The bottom panel is bottom aligned in a panel. The tabsheet is client aligned in the same panel & the day view is client aligned in the tabsheet. No problems, I just removed the bottom panel  . A new issue just arose. I use DrawingStyle of dsNone for the WeekView to completely eliminate borders & it worked before but in the recent updates, it says DrawingStyle not supported. Is this deliberate? I can always change the options in any case. JD ---------------------------------------------------------------------- wp · 2016-07-02 21:29 Quote from: JD on July 02, 2016, 11:13:00 pmA new issue just arose. I use DrawingStyle of dsNone for the WeekView and MonthView to completely eliminate borders & it worked before but in the recent updates, it says DrawingStyle not supported. Is this deliberate? I can always change the options in any case. Oh - I thought there are only the two options dsFlat and ds3D, my fault... I spent some time today in rewriting the style dsFlat such that no 3d-bevels are displayed. Yes, you are right, dsNone is useful for some "super-flat", borderless option (maybe I should take the freedom to rename it to dsNoBorder). But even after I'll remove the exception added today I guess it will not work well because there are many if constructs which do not consider a third case. Of course, this can be fixed. I made some progress with printing now. It is now possible to display the full page in the preview. I still see some bugs. Once they are fixed I'll update the demo to show this feature. ---------------------------------------------------------------------- JD · 2016-07-02 22:01 Quote from: wp on July 02, 2016, 11:29:57 pmQuote from: JD on July 02, 2016, 11:13:00 pmA new issue just arose. I use DrawingStyle of dsNone for the WeekView and MonthView to completely eliminate borders & it worked before but in the recent updates, it says DrawingStyle not supported. Is this deliberate? I can always change the options in any case. Oh - I thought there are only the two options dsFlat and ds3D, my fault... I spent some time today in rewriting the style dsFlat such that no 3d-bevels are displayed. Yes, you are right, dsNone is useful for some "super-flat", borderless option (maybe I should take the freedom to rename it to dsNoBorder). But even after I'll remove the exception added today I guess it will not work well because there are many if constructs which do not consider a third case. Of course, this can be fixed. dsNone makes the controls look more "modern". Quote from: wp on July 02, 2016, 11:29:57 pmI made some progress with printing now. It is now possible to display the full page in the preview. I still see some bugs. Once they are fixed I'll update the demo to show this feature. That's great. ---------------------------------------------------------------------- wp · 2016-07-03 09:44 New DrawingStyle dsNoBorder (replaces the former dsNone). If you had used dsNone somewhere in the lfm file be prepared of errors at loading. To avoid this load the lfm file into a text editor and replace all dsNone by dsNoBorder. ---------------------------------------------------------------------- JD · 2016-07-03 10:39 Quote from: wp on July 03, 2016, 11:44:29 amNew DrawingStyle dsNoBorder (replaces the former dsNone). If you had used dsNone somewhere in the lfm file be prepared of errors at loading. To avoid this load the lfm file into a text editor and replace all dsNone by dsNoBorder. I already experienced this yesterday. I was forced to restore from an old backup to be able to continue. I'll try out the new property ASAP. ---------------------------------------------------------------------- JD · 2016-07-03 17:27 I'm a little stumped. I have a form with a VpDayView, TVpBufDSDatastore and TVpControlLink. I pull resource and event data from a remote database and I copy it manually into the TVpBufDSDatastore Resource and Events using two procedures I wrote LoadTVPResource and LoadTVPEvents. See below Code: [Select]// LoadTVPResource procedure TfrmMain.LoadTVPResource(   ADatastore: TVpBufDSDatastore; AJSON: string); var   intGridRow, intNumberOfSQLQueryRows: integer;   // JSON related variables   jsParser: TJSONParser;   jsArrayRow: TJSONArray;   jsObj: TJSONObject; begin   //   if AJSON = EmptyStr then     exit;     // create the json parser   jsParser    := TJSONParser.Create(AJSON);   //   try     // Parse the JSON data     jsArrayRow  := jsParser.Parse as TJSONArray;     //     try       // get the number of rows returned by the query in the JSON data object       intNumberOfSQLQueryRows := jsArrayRow.Count;       // Empty the dataset       ADataStore.ResourceTable.Close;       ADataStore.ResourceTable.Open;       //AComboBox.Clear;       // append the json rows to the grid       for intGridRow := 0 to Pred(intNumberOfSQLQueryRows) { - 1} do       begin         // assign the object to jsObj         jsObj := jsArrayRow.Objects[intGridRow];         //         try           // All events related to a particular resource           //           with ADataStore.ResourceTable do           begin             //             Append;             //             if not jsObj.Items[0].IsNull then               FieldByName('resourceid').AsInteger         := jsObj.Items[0].AsInteger             else               FieldByName('resourceid').Clear;             //             if not jsObj.Items[2].IsNull then               FieldByName('description').AsString       := jsObj.Items[2].AsString             else               FieldByName('description').Clear;             //             if not jsObj.Items[3].IsNull then               FieldByName('notes').AsString          := jsObj.Items[3].AsString             else               FieldByName('notes').Clear;             //             if not jsObj.Items[4].IsNull then               FieldByName('imageindex').AsInteger         := jsObj.Items[4].AsInteger             else               FieldByName('imageindex').Clear;             //             if not jsObj.Items[5].IsNull then               FieldByName('resourceactive').AsBoolean      := jsObj.Items[5].AsBoolean             else               FieldByName('resourceactive').Clear;           end;         finally           //           jsObj.Clear;         end;       end;      // for intGridRow := 0 to intNumberOfSQLQueryRows - 1 do     finally       //       jsArrayRow.Free;     end;          // try...finally (jsParser := TJSONParser.Create(AJSString))   finally     // free the jsParser     FreeAndNil(jsParser);   end;   //   ADataStore.ResourceTable.Active := True; end; Code: [Select]// LoadTVPEvents procedure TfrmMain.LoadTVPEvents(   ADatastore: TVpBufDSDatastore; AJSON: string); var   intGridRow, intNumberOfSQLQueryRows: integer;   // JSON related variables   jsParser: TJSONParser;   jsArrayRow: TJSONArray;   jsObj: TJSONObject; begin   //   if AJSON = EmptyStr then     exit;   // create the json parser   jsParser    := TJSONParser.Create(AJSON);   //   try     // Parse the JSON data     jsArrayRow  := jsParser.Parse as TJSONArray;     //     try       // get the number of rows returned by the query in the JSON data object       intNumberOfSQLQueryRows := jsArrayRow.Count;       // Empty the dataset       ADataStore.EventsTable.Close;       ADataStore.EventsTable.Open;       // append the json rows to the grid       for intGridRow := 0 to Pred(intNumberOfSQLQueryRows) { - 1} do       begin         // assign the object to jsObj         jsObj := jsArrayRow.Objects[intGridRow];         //         try           // All events related to a particular resource           //           with ADataStore.EventsTable do           begin             //             Append;             //             if not jsObj.Items[0].IsNull then               FieldByName('recordid').AsInteger         := jsObj.Items[0].AsInteger             else               FieldByName('recordid').Clear;             //             if not jsObj.Items[1].IsNull then               FieldByName('resourceid').AsInteger         := jsObj.Items[1].AsInteger             else               FieldByName('resourceid').Clear;             //             if not jsObj.Items[3].IsNull then               FieldByName('starttime').AsDateTime       := SQLDateToDateTime(jsObj.Items[3].AsString)             else               FieldByName('starttime').Clear;             //             if not jsObj.Items[4].IsNull then               FieldByName('endtime').AsDateTime         := SQLDateToDateTime(jsObj.Items[4].AsString)             else               FieldByName('endtime').Clear;             //             if not jsObj.Items[5].IsNull then               FieldByName('description').AsString       := jsObj.Items[5].AsString             else               FieldByName('description').Clear;             //             if not jsObj.Items[6].IsNull then               FieldByName('location').AsString          := jsObj.Items[6].AsString             else               FieldByName('location').Clear;             //             if not jsObj.Items[7].IsNull then               FieldByName('notes').AsString             := jsObj.Items[7].AsString             else               FieldByName('notes').Clear;             //             if not jsObj.Items[8].IsNull then               FieldByName('category').AsInteger         := jsObj.Items[8].AsInteger             else               FieldByName('category').Clear;             //             if not jsObj.Items[9].IsNull then               FieldByName('alldayevent').AsBoolean      := jsObj.Items[9].AsBoolean             else               FieldByName('alldayevent').Clear;             //             if not jsObj.Items[10].IsNull then               FieldByName('dingpath').AsString          := jsObj.Items[10].AsString             else               FieldByName('dingpath').Clear;             //             if not jsObj.Items[11].IsNull then               FieldByName('alarmset').AsBoolean         := jsObj.Items[11].AsBoolean             else               FieldByName('alarmset').Clear;             //             if not jsObj.Items[12].IsNull then               FieldByName('alarmadvance').AsInteger         := jsObj.Items[12].AsInteger             else               FieldByName('alarmadvance').Clear;             //             if not jsObj.Items[13].IsNull then               FieldByName('alarmadvancetype').AsInteger     := jsObj.Items[13].AsInteger             else               FieldByName('alarmadvancetype').Clear;             //             if not jsObj.Items[14].IsNull then               FieldByName('snoozetime').AsDateTime      := SQLDateToDateTime(jsObj.Items[14].AsString)             else               FieldByName('snoozetime').Clear;             //             if not jsObj.Items[15].IsNull then               FieldByName('repeatcode').AsInteger       := jsObj.Items[15].AsInteger             else               FieldByName('repeatcode').Clear;             //             if not jsObj.Items[16].IsNull then               FieldByName('repeatrangeend').AsDateTime  := SQLDateToDateTime(jsObj.Items[16].AsString)             else               FieldByName('repeatrangeend').Clear;             //             if not jsObj.Items[17].IsNull then               FieldByName('custominterval').AsBoolean   := jsObj.Items[17].AsBoolean             else               FieldByName('custominterval').Clear;           end;         finally           //           jsObj.Clear;         end;       end;      // for intGridRow := 0 to intNumberOfSQLQueryRows - 1 do     finally       //       jsArrayRow.Free;     end;          // try...finally (jsParser := TJSONParser.Create(AJSString))   finally     // free the jsParser     FreeAndNil(jsParser);   end;   //   ADataStore.EventsTable.Active := True;   //   if not ADataStore.Connected then ADataStore.Connected := True; end; The problem is I don't see the events on the VpDayView in the form. The DayView keeps saying no resource has been selected. Does that mean I have to somehow use a TVpResourceCombo no matter what? Thanks, JD ---------------------------------------------------------------------- wp · 2016-07-03 18:00 Could it be that the "Post" is missing for both datasets? Is this code happening when the datastore is connected? In order so see the new records in the planner controls there must be more code. In particular you must create TVpEvent and TVpResource instances and add them to the internal lists. This is the primary storage location. The ini datastore shows that the components do not need anything else. The datasets or ini file are just needed to get persistent data, i.e. to keep data after the program ends. I think it would be easier to disconnect the datastore while adding the data from the remote db, copy the data to the buf datasets like you do and then reconnect to rebuild the internal data structures. To access the resource, events etc. datasets while the datastore is closed you can open these dataset manually - I think your sequence of xxxTable.Close and xxxTable.Open is correct. ---------------------------------------------------------------------- JD · 2016-07-03 18:22 Quote from: wp on July 03, 2016, 08:00:16 pmCould it be that the "Post" is missing for both datasets? Is this code happening when the datastore is connected? In order so see the new records in the planner controls there must be more code. In particular you must create TVpEvent and TVpResource instances and add them to the internal lists. This is the primary storage location. The ini datastore shows that the components do not need anything else. The datasets or ini file are just needed to get persistent data, i.e. to keep data after the program ends. I think it would be easier to disconnect the datastore while adding the data from the remote db, copy the data to the buf datasets like you do and then reconnect to rebuild the internal data structures. To access the resource, events etc. datasets while the datastore is closed you can open these dataset manually - I think your sequence of xxxTable.Close and xxxTable.Open is correct. The VpBufDSDataset has Autoconnect = true and AutoCreate = true. Do I still need to manually create TVpResource and TvpEvent instances when AutoCreate is true. ---------------------------------------------------------------------- wp · 2016-07-03 18:35 No. AutoCreate refers to creation of the database tables. I'd turn both AutoXXXX off in object inspector. When you run your program for the first time, the tables do not yet exist. Call TVpDatastore.CreateTables to create the tables. Then use your own procedure to populate the tables with the data from the remote DB, I'm not sure if the datastore can be connected during this, maybe it's better to turn it off. Finally set Datastore.Connected to true in order to load data into the internal structures. When the program runs later when the tables already exist and have been populated just set Datastore.Connected to true in FormCreate. ---------------------------------------------------------------------- JD · 2016-07-03 19:21 Quote from: wp on July 03, 2016, 08:35:31 pmNo. AutoCreate refers to creation of the database tables. I'd turn both AutoXXXX off in object inspector. When you run your program for the first time, the tables do not yet exist. Call TVpDatastore.CreateTables to create the tables. Then use your own procedure to populate the tables with the data from the remote DB, I'm not sure if the datastore can be connected during this, maybe it's better to turn it off. Finally set Datastore.Connected to true in order to load data into the internal structures. When the program runs later when the tables already exist and have been populated just set Datastore.Connected to true in FormCreate. I did exactly that but it still says No Resource Selected when I click the DayView. However when I accepted to select a resource, it showed me the resource I had added in the code above. So the data is there, it is just that the resource is not being loaded. How do I load the resource from the code? ---------------------------------------------------------------------- wp · 2016-07-03 19:43 In the BufDSDatastore demo I am doing this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  lastRes: TVpResource;...  if VpBufDSDatastore1.Resources.Count > 0 then  begin    // Find the last resource ID value    lastRes := VpBufD SDatastore1.Resources.Items[VpBufDSDatastore1.Resources.Count-1];    VpBufDSDatastore1.ResourceID := lastRes.ResourceID;      // or: store the ID of the currently loaded Resource in a cfg file and restore it like this    // VpBufDSDatastore1.ResourceID := resourceID_from_cfg_file;  // resourceID value read from cfg file  end; ---------------------------------------------------------------------- JD · 2016-07-03 20:28 @wp Thanks for pointing that out. Now it loads the Resource. But the two events associated with the resource are not displayed in the DayView. What am I missing? Thanks, JD ---------------------------------------------------------------------- wp · 2016-07-03 20:47 You could add a temporary DBGrid to the form which you can link, via a TDataSource, to the EventsTable of the TVpBufDSDatastore. This is accessible by a non-published property which you connect to the Datasource at runtime. Do you see the events in the grid? Are all fields correctly populated? If this is ok, is the Directory of the TVpBufDSDatastore set correctly? You could also use the BufDSDatastore demo to open your manually create buf database. And a final idea: The BufDSDatastore uses autoincremented ID fields. In this case your own procedure cannot write the ID values to the resource and event tables. You can fix this during writing of the resource table this way: Store the Resource ID which is found in your original table. Write the Resource record to the bufDS, but without the ResourceID field which is autocreated. Read the written record and store the ResourceID used along with the original value. Later when writing the Events table read the Resource ID used in your original table. Lookup the Resource ID written before and use this value when writing the Event record. Don't write the RecordID of the Event Table because it is autocreated as well. ---------------------------------------------------------------------- JD · 2016-07-03 20:56 Quote from: wp on July 03, 2016, 10:47:29 pmYou could add a temporary DBGrid to the form which you can link, via a TDataSource, to the EventsTable of the TVpBufDSDatastore. This is accessible by a non- published property which you connect to the Datasource at runtime. Do you see the events in the grid? Are all fields correctly populated? If this is ok, is the Directory of the TVpBufDSDatastore set correctly? You could also use the BufDSDatastore demo to open your manually create buf database. And a final idea: The BufDSDatastore uses autoincremented ID fields. In this case your own procedure cannot write the ID values to the resource and event tables. You can fix this during writing of the resource table this way: Store the Resource ID which is found in your original table. Write the Resource record to the bufDS, but without the ResourceID field which is autocreated. Read the written record and store the ResourceID used along with the original value. Later when writing the Events table read the Resource ID used in your original table. Lookup the Resource ID written before and use this value when writing the Event record. Don't write the RecordID of the Event Table because it is autocreated as well. This is what I did. I created the Resource and Events by inserting data into a Resource & Event table on the server so the IDs are created automatically same as if I used an SQLite database. The IDs are properly created so the problem is not there. I want to retrieve the data and show it client-side. I have populated the BufDSDatastore and I know the data is there because RecordCount gives the right values. I delete ALL *.db files after the program exits so that the program ONLY uses data retrieved from the remote server. Is there a command I need to use to show the Events? Thanks, JD ---------------------------------------------------------------------- wp · 2016-07-03 21:11 Quote from: JD on July 03, 2016, 10:56:35 pmThis is what I did. I created the Resource and Events by inserting data into a Resource & Event table on the server so the IDs are created automatically same as if I used an SQLite database. The IDs are properly created so the problem is not there. I want to retrieve the data and show it client- side. I have populated the BufDSDatastore and I know the data is there because RecordCount gives the right values. I believe you that the IDs are correct in the original database. But I think the issue is in the IDs in the db files - since here the ID fields have the autoinc flag tvplanit will recreate the IDs - and screw up everything. Maybe I should offer an option to use regular integer ID fields. But it restricts the original application I had in mind, and therefore I am a bit hesistant. We should make sure of validity of the IDs in the db files. If you don't mind could you upload the .db files here? ---------------------------------------------------------------------- JD · 2016-07-03 21:20 Here they are: the Events & Resources table contain 2 & I records respectively with a ResourceID of 2 in each table. Thanks, JD ---------------------------------------------------------------------- wp · 2016-07-03 21:48 The ResourcesTable has ResourceID 1, but the ResourceID is 2 in the events table (use attached program, copy both db files to its exe directory). Please check your code, or post the procedure which creates the tables (in the beginning I got easily confused by the RecordID and ResourceID fields). ---------------------------------------------------------------------- JD · 2016-07-03 22:09 Quote from: wp on July 03, 2016, 11:48:58 pmThe ResourcesTable has ResourceID 1, but the ResourceID is 2 in the events table (use attached program, copy both db files to its exe directory). Please check your code, or post the procedure which creates the tables (in the beginning I got easily confused by the RecordID and ResourceID fields). Thanks, I'll check the code. I populated & created the tables using SQL on the server. ---------------------------------------------------------------------- JD · 2016-07-03 22:16 The code looks OK. Is there a possibility that the ResourceID field is being overwritten by TVPlanit? JD ---------------------------------------------------------------------- JD · 2016-07-03 22:27 I know where the bug is Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //// LoadTVPResource//procedure TfrmMain.LoadTVPResource(  var ADatastore: TVpBufDSDatastore; AJSON: string);var  intGridRow, intNumberOfSQLQueryRows: integer;  // JSON related variables  jsParser: TJSONParser;  jsArrayRow: TJSONArray;  jsObj: TJSONObject;  //  lastRes: TVpResource;begin  //  if AJSON = EmptyStr then    exit;   //  ADataStore.CreateTables;   // create the json parser  jsParser    := TJSONParser.Create(AJSON);  //  try    // Parse the JSON data    jsArrayRow  := jsParser.Parse as TJSONArray;    //    try      // get the number of rows returned by the query in the JSON data object      intNumberOfSQLQueryRows := jsArrayRow.Count;      // Empty the dataset      ADataStore.ResourceTable.Close;      ADataStore.ResourceTable.Open;      //AComboBox.Clear;      // append the json rows to the grid      for intGridRow := 0 to Pred(intNumberOfSQLQueryRows) { - 1} do      begin        // assign the object to jsObj        jsObj := jsArrayRow.Objects[intGridRow];      //        try          // All events related to a particular resource          //          with ADataStore.ResourceTable do        begin            //            Append;            //            if not jsObj.Items[0].IsNull then            begin              FieldByName('resourceid').AsInteger         := jsObj.Items[0].AsInteger;              ShowMessage(jsObj.Items[0].AsString);              ShowMessage(FieldByName('resourceid').AsString);            end          else              FieldByName('resourceid').Clear;            //          if not jsObj.Items[2].IsNull then              FieldByName('description').AsString       := jsObj.Items[2].AsString          else              FieldByName('description').Clear;          //            if not jsObj.Items[3].IsNull then              FieldByName('notes').AsString          := jsObj.Items[3].AsString          else              FieldByName('notes').Clear;            //          if not jsObj.Items[4].IsNull then              FieldByName('imageindex').AsInteger         := jsObj.Items[4].AsInteger            else              FieldByName('imageindex').Clear;            //            if not jsObj.Items[5].IsNull then              FieldByName('resourceactive').AsBoolean      := jsObj.Items[5].AsBoolean            else              FieldByName('resourceactive').Clear;            //            Post;        end;        finally          //          jsObj.Clear;        end;      end;      // for intGridRow := 0 to intNumberOfSQLQueryRows - 1 do    finally      //      jsArrayRow.Free;    end;          // try...finally (jsParser := TJSONParser.Create(AJSString))  finally    // free the jsParser    FreeAndNil(jsParser);  end;  //  ADataStore.ResourceTable.Active := True;   // Connect the datastore to the newly added data  if not ADatastore.Connected then ADatastore.Connected := True;    //  if ADatastore.Resources.Count > 0 then  begin    // Find the last resource ID value    lastRes := ADatastore.Resources.Items[ADatastore.Resources.Count];    ADatastore.ResourceID := lastRes.ResourceID;             [b]<-----------------  ResourceID is set to 1 here[/b]  end;end;  The bug is in Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   //  if ADatastore.Resources.Count > 0 then  begin    // Find the last resource ID value    lastRes := ADatastore.Resources.Items[ADatastore.Resources.Count];    ADatastore.ResourceID := lastRes.ResourceID;     end;  ADatastore.ResourceID is reset to 1 in ADatastore.ResourceID := lastRes.ResourceID JD ---------------------------------------------------------------------- wp · 2016-07-03 23:06 Good that you found it. I still don't understand, though, why the autoinc fields can be written. Is this a feature of TBufDataset? Maybe my update that I posted a minute ago is not necessary. TBufDSDatasource has a new property UseAutoIncFields. This is true by default. In cases where the AutoInc fields must be preserved set it to false BEFORE the tables are created (afterwards you cannot change it any more), For records created after importing your database random numbers will be selected for the ID fields. If your corrected version is working fine now I'll resume the commit because it is not needed. ---------------------------------------------------------------------- JD · 2016-07-03 23:22 Quote from: wp on July 04, 2016, 01:06:05 amGood that you found it. I still don't understand, though, why the autoinc fields can be written. Is this a feature of TBufDataset? Maybe my update that I posted a minute ago is not necessary. TBufDSDatasource has a new property UseAutoIncFields. This is true by default. In cases where the AutoInc fields must be preserved set it to false BEFORE the tables are created (afterwards you cannot change it any more), For records created after importing your database random numbers will be selected for the ID fields. If your corrected version is working fine now I'll resume the commit because it is not needed. I'll update & test immediately. ---------------------------------------------------------------------- JD · 2016-07-03 23:46 @wp Now the ResourceIDs match (see screenshot) but the events still do not show in the DayView. I'll keep digging..... ---------------------------------------------------------------------- wp · 2016-07-04 08:06 And when you run the previous version (r4905)? Does it produce matching IDs as well? You wrote that you found a bug in your code. I'd prefer to revert to r4905 because with the random IDs I have a bad feeling of what happens when you copy the changes in the local tables back to the server As for the events not showing in the DayView: Did you set BufDSDatastore.Connected to true after importing the data into the BufDatasets? This would load data from the datasets into the internal lists and sets an internal Flag (FConnected). After that, call the code that I proposed above to select the ResourceID. ---------------------------------------------------------------------- JD · 2016-07-04 08:35 Quote from: wp on July 04, 2016, 10:06:39 amAnd when you run the previous version (r4905)? Does it produce matching IDs as well? You wrote that you found a bug in your code. I'd prefer to revert to r4905 because with the random IDs I have a bad feeling of what happens when you copy the changes in the local tables back to the server I overwrote svn 4905. Can you please leave the new property UseAutoIncFields and make it optional? Forcing its use/application is what reset the ResourceID to 1 because there is only one resource in the Resource table in BufDSDatastore.  My server takes care of auto inc fields like this: Resources table on the server: ResourceID (auto incremented by server) Events table on the server: EventID (or RecordID in the DBGrid screenshot - auto incremented by server), ResourceID (foreign key link to Resource table) I keep the server created IDs in memory & will overwrite any random ID generated by BufDSDatastore before committing the changes. In addition, my resources are tied to employee contract ID which are never exposed for modification client side. So I have no concerns over there. Quote from: wp on July 04, 2016, 10:06:39 amAs for the events not showing in the DayView: Did you set BufDSDatastore.Connected to true after importing the data into the BufDatasets? This would load data from the datasets into the internal lists and sets an internal Flag (FConnected). After that, call the code that I proposed above to select the ResourceID. I set BufDSDatastore.Connected to true. See the code below the last lines of my LoadTVPEvents procedure. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   // Events table is now populated so activate it, connect it and set the last resource ID   //  ADatastore.EventsTable.Active := True;   // Connect the datastore to the newly added data  if not ADatastore.Connected then ADatastore.Connected := True;  //  if ADatastore.Resources.Count > 0 then  begin    // Find the last resource ID value    lastRes := ADatastore.Resources.Items[ADatastore.Resources.Count - 1];    ADatastore.ResourceID := lastRes.ResourceID;    //ResourceEventID := lastRes.ResourceID;  end; ---------------------------------------------------------------------- wp · 2016-07-04 09:22 Quote from: JD on July 04, 2016, 10:35:43 amI set BufDSDatastore.Connected to true. See the code below the last lines of my LoadTVPEvents procedure. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   // Events table is now populated so activate it, connect it and set the last resource ID   //  ADatastore.EventsTable.Active := True;   // Connect the datastore to the newly added data  if not ADatastore.Connected then ADatastore.Connected := True;  //  if ADatastore.Resources.Count > 0 then  begin    // Find the last resource ID value    lastRes := ADatastore.Resources.Items[ADatastore.Resources.Count - 1];    ADatastore.ResourceID := lastRes.ResourceID;    //ResourceEventID := lastRes.ResourceID;  end; Looks ok. Did you try to load the generated db files into the bufdsdatastore demo in folder examples? ---------------------------------------------------------------------- JD · 2016-07-04 09:53 I need clarification with something. a) First I fill the VpBufDSDatastore Resource table and then I activate it b) Next I fill the VpBufDSDatastore Events table and then I activate it c) I then set VpBufDSDatastore connected to true d) I then get the last ResourceID Is this the correct order? JD ---------------------------------------------------------------------- wp · 2016-07-04 09:59 I think its needed need to open the dataset in (a) and (b), but I think also that it should not be harmful. The rest is just the way I would do it. NB: Of course, in (d) you can pick any existing ResourceID. ---------------------------------------------------------------------- JD · 2016-07-04 10:16 Quote from: wp on July 04, 2016, 11:59:02 amI think its needed need to open the dataset in (a) and (b), but I think also that it should not be harmful. The rest is just the way I would do it. NB: Of course, in (d) you can pick any existing ResourceID. The dataset is Open when Active. So if you are saying the order is correct, why is my Dayview empty? Should I be looking at the settings of ControlLink in the code too? ---------------------------------------------------------------------- wp · 2016-07-04 10:33 Before I think about this, please answer my question: Do your db files open in the bufdsdatastore demo? ---------------------------------------------------------------------- JD · 2016-07-04 12:08 Quote from: wp on July 04, 2016, 12:33:52 pmBefore I think about this, please answer my question: Do your db files open in the bufdsdatastore demo? I can see the Resource but not the Events. See attached JD ---------------------------------------------------------------------- JanRoza · 2016-07-04 12:16 JD, attached is a dutch language file as addition for tvplanit. Because po files can not be uploaded I changed the extension from po to txt, just rename it and you have your po file again. Hope you can use it. ---------------------------------------------------------------------- wp · 2016-07-04 12:23 Quote from: JD on July 04, 2016, 02:08:35 pmI can see the Resource but not the Events. See attached If we're still talking about the same files that you posted above the start and end dates are lacking the date part. Therefore, they occur at midnight, and you have to scroll the dayview up to see midnight. But the events are not seen this way either because they have zero duration. In addition, the 2nd event has the dates in reverse order (tvplanit does not allow to enter this, but a check is missing for the initial read of a table). After manually editing the dates, and setting the resourceiD to 1, the events show correctly in the planner. ---------------------------------------------------------------------- wp · 2016-07-04 12:42 @JanRoza: Thanks for submitting the dutch translation. I just added it to the distribution and updated the "demo" application to handle the dutch LCID  (note if you run "demo" the main program will still be in English because the demo.po is still untranslated to nl, but the tvplanit dialogs are in dutch). ---------------------------------------------------------------------- JD · 2016-07-04 14:10 Quote from: JanRoza on July 04, 2016, 02:16:36 pmJD, attached is a dutch language file as addition for tvplanit. Because po files can not be uploaded I changed the extension from po to txt, just rename it and you have your po file again. Hope you can use it. Thanks JanRoza. I'll upload a French language file myself in a couple of days. JD ---------------------------------------------------------------------- xinyiman · 2016-07-05 10:15 I installed the currently released version of mac and when I open the sample project demo I go into the development environment crashes. Without compiling it, just trying to see the form ---------------------------------------------------------------------- wp · 2016-07-05 10:39 Sorry I don't have a Mac, so OSX support is completely untested... If you want to get it fixed you must help me. Please find out which revision broke the OSX functionality. I hope you know which revision you used for the last test which had bugs but at least a functional IDE - your last post was on July2, therefore, the revision must be >4890. Update your svn repository to this revision - rebuild the IDE, it should work. Then update svn to a revision somewhere in the middle between this and the current revision(say: 4905). Rebuild the IDE. Does it work? If it does go to a revision between this and the current revision (say: 4912), and repeat. If it does not go to a revision between this and the last revision that was working (say: 4897), and repeat. After some more tries you will know the first revision at which OSX is broken. Report this info back. ---------------------------------------------------------------------- xinyiman · 2016-07-05 13:27 Quote from: wp on July 05, 2016, 12:39:10 pmSorry I don't have a Mac, so OSX support is completely untested... If you want to get it fixed you must help me. Please find out which revision broke the OSX functionality. I hope you know which revision you used for the last test which had bugs but at least a functional IDE - your last post was on July2, therefore, the revision must be >4890. Update your svn repository to this revision - rebuild the IDE, it should work. Then update svn to a revision somewhere in the middle between this and the current revision(say: 4905). Rebuild the IDE. Does it work? If it does go to a revision between this and the current revision (say: 4912), and repeat. If it does not go to a revision between this and the last revision that was working (say: 4897), and repeat. After some more tries you will know the first revision at which OSX is broken. Report this info back. Ok, for example, what command should I use to get the 4890 version? ---------------------------------------------------------------------- wp · 2016-07-05 14:15 I don't known which svn tool is available on the Mac. On Windows, I use TortoiseSVN, right-click my repository and select "TortoiseSVN" > "Update to revision..." and enter 4890. On Linux, I have the standard svn client and cd to the root of the local repository and type "svn up -r4890" in a console. Don't forget to rebuild Lazarus after svn is finished. ---------------------------------------------------------------------- JanRoza · 2016-07-05 20:27 @wp: sorry I hadn't looked at the demo translation. I'll translate that one as well in the next few days. ---------------------------------------------------------------------- xinyiman · 2016-07-06 06:38 Quote from: wp on July 05, 2016, 12:39:10 pmSorry I don't have a Mac, so OSX support is completely untested... If you want to get it fixed you must help me. Please find out which revision broke the OSX functionality. I hope you know which revision you used for the last test which had bugs but at least a functional IDE - your last post was on July2, therefore, the revision must be >4890. Update your svn repository to this revision - rebuild the IDE, it should work. Then update svn to a revision somewhere in the middle between this and the current revision(say: 4905). Rebuild the IDE. Does it work? If it does go to a revision between this and the current revision (say: 4912), and repeat. If it does not go to a revision between this and the last revision that was working (say: 4897), and repeat. After some more tries you will know the first revision at which OSX is broken. Report this info back. In the 4905 version it will close for no reason the ide. So I would say that this is the version of Mac does not have the bug I reported you. ---------------------------------------------------------------------- wp · 2016-07-06 08:34 Quote from: xinyiman on July 06, 2016, 08:38:22 amIn the 4905 version it will close for no reason the ide. So I would say that this is the version of Mac does not have the bug I reported you. Sorry to be insistent but I must be sure, there are a lot of changes: This statement is contradicting: "... will close for no reason the ide" says that r4905 is faulty. But in the next sentence you say the opposite: "this is the version of Mac does not have the bug". So, what is the first version in which the IDE closes? Or, what is the last version in which the IDE opens correctly? If the faulty commit to svn is too bug it may be difficult to locate the culprit. Therefore I'd ask you for one more favor: Update your local repository to the first defective revision. Go to "Package" > "Install/uninstall packages" and uninstall the tvplanit packages (laz_visualplanit*). Then go to "Package" / "Open package file" and load the package "laz_tvplanit.lpk" from the defective version repository. Compile the package, but don't install it. This way your IDE will remain operative. Now open the attached demo project; it is a runtime version of tvplanit which should work without the components being installed. Compile and run it. In your case, it should crash somewhere (but not kill the IDE). Tell me where it crashes. ---------------------------------------------------------------------- wp · 2016-07-06 13:45 @JD: You wrote somewhere above that you use TBufDSDatastore as a temporary storage and erase the db files afterwards. Then maybe the new property "Persistent" is interesting for you. Its default is true and results in the current behavior. But if it is false all data are held in memory, no need to delete anything... ---------------------------------------------------------------------- JD · 2016-07-06 21:27 Quote from: wp on July 06, 2016, 03:45:53 pm@JD: You wrote somewhere above that you use TBufDSDatastore as a temporary storage and erase the db files afterwards. Then maybe the new property "Persistent" is interesting for you. Its default is true and results in the current behavior. But if it is false all data are held in memory, no need to delete anything... Just tested it. I like it. Thanks for your good work. By the way, I've noticed that are memory leaks in the examples. I built (in Debug mode) the bufdsdatastore and the inidatastore examples & they both reported memory leaks. ---------------------------------------------------------------------- wp · 2016-07-06 22:01 Ah, thanks for reporting. But it was an easy one. Fixed. ---------------------------------------------------------------------- JanRoza · 2016-07-09 22:20 @wp: As promised the dutch po file for the demo. ---------------------------------------------------------------------- wp · 2016-07-09 22:42 Thanks. ---------------------------------------------------------------------- SunyD · 2016-11-20 00:54 This component needs some work for including the image resources. It includes all images in compiled programms, even the images for the lazarus-component-platte too. Compile gadgets example and inspect the programmfile with resource editor. ---------------------------------------------------------------------- wp · 2016-11-20 10:03 I don't see how including all images needed by the package internally to the final application could be prevented. But having the component palette icons in the resource definitely looks wrong. At the moment I don't see where this happened. Since I want to focus on other things I cannot investigate too much. Can you give me a hint, or, better, can you write a patch? ---------------------------------------------------------------------- SunyD · 2016-11-20 18:37 Quote from: wp on November 20, 2016, 11:03:38 amI don't see how including all images needed by the package internally to the final application could be prevented. But having the component palette icons in the resource definitely looks wrong. At the moment I don't see where this happened. Since I want to focus on other things I cannot investigate too much. Can you give me a hint, or, better, can you write a patch? Images for component palette included as *.res files. I find out lazarus/fpc include it in every programm if they are *.res/*.dcr files, so images for component palette must be included as lazarus resources (.lrs-Files). I made for you lrs-file in zip-file. Why have you added IDEIntf to required packages? Is it needed? I think you should remove all unneeded units from laz_visualplanit.pas and put it to vpreg.pas, because packageunits (here laz_visualplanit.pas) are included to every application if you this package. 1. Comment out {$R VpReg.RES} from this units: VpRegF2.pas VpRegAd.pas VpRegIs.pas Because one from vpreg.pas is enough. 2.  Open vpreg.pas and made this changes: a)   from {$R vpreg.res} { Palette Glyphs           }     to {$ifndef FPC} {$R vpreg.res} { Palette Glyphs           } {$endif} b) Add to uses: {$IFDEF LCL}   LResources, .... c) at end of file: {$ifdef FPC} initialization {$I vpreg.lrs} // Palette glyphs {$endif} end. 3. Make same from 2. to vpregzeos.pas but the resources for vpregzeos.pas named vpregzeos.res/lrs. You find in zip-file the images and resources. (You don't need images now, maybe in future for changes). ---------------------------------------------------------------------- SunyD · 2016-11-20 19:41 We should designtime and runtime packages. Package IDEIntf should placed in designtimepackage and removed from runtime package. Because with IDEINtf all images/forms from ObjectInspector/Propertyeditor will be included in the programm file. Look the images from the example gadgets below,  left compiled visualplanit without ideintf. Right coints all images/forms from ObjectINspector and left is 2,39 MB right is 3,84 MB. 1,5 MB for useless data. My  recommendation for package devoloper is: - put component  images for component-palette in lrs-files not in res/dcr-files. (fpc includes res-files in every programm that uses this package.) - seperate designtime with runtime-package, don't put IDEint in runtime packages. ---------------------------------------------------------------------- wp · 2016-11-20 21:07 Yes, splitting off designtime code into a separate package is certainly the way to go. This is strictly enforced by Delphi now, but Lazarus still allows the combined runtime/designtime packages. Users, however, will not be very happy because they have to touch another package for installation... I am not sure about the need to use lrs resources. I loaded several binaries of other Lazarus programs into the resource editor, and it is only the tvplanit programs which contain the palette icons. It must be related to the component and property editors registered along with the component registration. I would like to avoid using both lrs and res resources in the same package separated by an ugly IFDEF construction. BTW Lazarus version vs. Delphi version: The current version in ccr still contains a lot of IFDEF FPC or IFDEF DELPHI, which suggests that the package would still compile with Delphi. I tried in an earlier stage of my work: it does not. Soner, I know that you have some experience with this package as well, what is your opinion: shouldn't these IFDEFs be removed in the long run to keep a pure Lazarus version? I think nobody will ever make the effort to make the package Delphi-compatible again. ---------------------------------------------------------------------- SunyD · 2016-11-20 22:27 Quote from: wp on November 20, 2016, 10:07:24 pmI am not sure about the need to use lrs resources. I loaded several binaries of other Lazarus programs into the resource editor, and it is only the tvplanit programs which contain the palette icons. It must be related to the component and property editors registered along with the component registration. I think it is caused by lrs-resources. It tested it also with HtmlViewer-Components (https://github.com/BerndGabriel/HtmlViewer). With lrs-Resources the images for component-palette and editor-forms are not included in programm file. Quote from: wp on November 20, 2016, 10:07:24 pmSoner, I know that you have some experience with this package as well, what is your opinion: shouldn't these IFDEFs be removed in the long run to keep a pure Lazarus version? I think nobody will ever make the effort to make the package Delphi-compatible again. Yes, i think delphi compatibility can be dropped, noone goes back to delphi from lazarus.  I saw someone on github maintains turbo power controls for new delphi versions. I think lazarus and fpc is good enough, the lazarus/fpc user sould forget delphi and concentrate to lazarus/fpc. It is good to separete package if package contains own editors (IDEintf!). Here is more information about packages http://wiki.freepa scal.org/Lazarus_Packages#Design_Time_vs_Run_Time_package ---------------------------------------------------------------------- Graeme · 2016-11-20 23:56 Quote from: Soner A. on November 20, 2016, 11:27:22 pmI think lazarus and fpc is good enough, the lazarus/fpc user sould forget delphi and concentrate to lazarus/fpc. Exactly! That's what I've done 9 years ago, and haven't regretted it ever. There is only one dual-compiler project I still maintain, and I must say it is a pain in the butt. Delphi does nothing to be Free Pascal compatible (even if FPC had the features first), so why bother the other way round! Free Pascal is by far good enough to stand on its own - it needs nothing from Delphi. The only thing Delphi has that is better, is a debugger. ---------------------------------------------------------------------- wp · 2016-11-21 17:27 The new svn version of tvplanit has separate designtime and runtime packages. Now component palette images are no longer contained in the exe file (even with .res resource - file size is the same with .res and .lrs resources). The size of the gadgets demo decreases from 4.2MB to 3.0 MB (debugger symbols stripped). In addition I moved the lpk files to the root folder of the libraray for better visibility. Since the new version contains major changes with respect to package and compiled file locations I'd suggest to uninstall the old tvplanit package first. Then open the runtime package, "laz_visualplanit.lpk", in "Package/Open package file .pk" and compile. Then open the designtime package "laz_visualplanit_design.lpk" as well and click "Use" > "Install" to recompile the IDE with the new package. Repeat with the zeos addon packages if you want them. Please report any issues here - it is very easy to forget a local file to upload to the central repository. If everything is fine I'll create a new zipped release version soon.