From aaa5500 at ya.ru Fri Sep 1 07:29:42 2017 From: aaa5500 at ya.ru (Alexey) Date: Fri, 1 Sep 2017 08:29:42 +0300 Subject: [Lazarus] TControl.ChangeScale impl Message-ID: There is such procedure. why not to rewrite it via call to AutoAdjustLayout. to not have "dup" code. procedure TControl.ChangeScale(Multiplier, Divider: Integer); var R: TRect; begin if Multiplier <> Divider then begin ScaleConstraints(Multiplier, Divider); if not ParentFont then Font.Height := MulDiv(GetFontData(Font.Reference.Handle).Height, Multiplier, Divider); R := BaseBounds; if (Self is TCustomForm) and (GetParentForm(Self, True) = Self) then begin //Dont change Left,Top if this is the topmost form R.Right := R.Left + MulDiv(R.Right-R.Left, Multiplier, Divider); R.Bottom := R.Top + MulDiv(R.Bottom-R.Top, Multiplier, Divider); end else begin R.Left := MulDiv(R.Left, Multiplier, Divider); R.Top := MulDiv(R.Top, Multiplier, Divider); R.Right := MulDiv(R.Right, Multiplier, Divider); R.Bottom := MulDiv(R.Bottom, Multiplier, Divider); end; BoundsRect := R; end; end; -- Regards, Alexey From bo.berglund at gmail.com Fri Sep 1 07:35:15 2017 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 01 Sep 2017 07:35:15 +0200 Subject: [Lazarus] Dangers of using Move command to insert data into a TBytes array? References: Message-ID: <7grhqcdk869kvbsmiugnu6k4ocsu3ql53p@4ax.com> On Wed, 30 Aug 2017 09:48:47 +0200 (CEST), Michael Van Canneyt via Lazarus wrote: >> I must use Move() for handling other data of various kinds like packed >> records and such too... > >If the packed records contain managed data (ansistrings and the like): >Don't use move. Thanks for the advice! I now have looked over the code and found that the records used are fixed length, but there exist in some places a few ID members that are supposed to hold an array of AnsiChar, like in this example: TSSCmdDirRec = packed record CmdProgNum: shortint; InUse: shortint; ProgID: array[0..16] of AnsiChar; // <== here! meastype: byte; numSteps: word; MUX: shortint; numElecs: word; progLoc: cardinal; ArrayID: shortint; end; These records are equivalents of the C structs used on an embedded data collection system, which sends data organized in this way in straight binary form. In the case of ProgID it is defined there as: char progID[17]; What I do is that I receive the binary data into a buffer, then use Move() to copy the data into a local varable of the record type and finally I use a procedure to switch endianness on members which are multi-byte. This has worked fine until Unicode was introduced in Delphi/FPC when I tried to fix it using AnsiChar and AnsiString as appropriate. But no string type in these records, just arrays of AnsiChar... Anyway, I'm glad I checked with you. I initially had calculated the number of bytes in my Move operation erroneously. Now fixed. I did not see any side effects of it though, probably just pure luck. -- Bo Berglund Developer in Sweden From andrea.mauri.75 at gmail.com Fri Sep 1 20:23:56 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Fri, 1 Sep 2017 20:23:56 +0200 Subject: [Lazarus] TCheckListBox OnClickCheck on OSX Message-ID: <7949d4ff-5a22-d634-4297-5e3f9e82b3ca@gmail.com> I noticed a different behaviour of OnCLickCheck event between win and osx. In win I can do the following, Since ItemIndex is updated before ClickCheck event: procedure TForm1.CheckListBox1ClickCheck(Sender: TObject); begin label1.caption:= inttostr(CheckListBox1.ItemIndex); end; while on OSX the ItemIndex I got in OnClickCheck is not updated. If I have not clicked on any item before ItemIndex is -1. On OSX I have laz 1.6.4 and fpc 3.0.2. I noticed a similar thread in 2009: http://lists.lazarus.freepascal.org/pipermail/lazarus/2009-October/045577.html From juha.manninen62 at gmail.com Sat Sep 2 09:34:08 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sat, 2 Sep 2017 10:34:08 +0300 Subject: [Lazarus] FPC trunk + GTK2 widgetset + AnchorDocking Message-ID: In my tests Lazarus compiled with FPC trunk for GTK2 widgetset breaks AnchorDocking completely. Please see my comment here: https://bugs.freepascal.org/view.php?id=32342#c102573 Can others reproduce or is it just my config issue? Juha From nc-gaertnma at netcologne.de Sat Sep 2 11:39:35 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sat, 2 Sep 2017 11:39:35 +0200 Subject: [Lazarus] FPC trunk + GTK2 widgetset + AnchorDocking In-Reply-To: References: Message-ID: <20170902113935.5afb2970@limapholos.matflo.wg> On Sat, 2 Sep 2017 10:34:08 +0300 Juha Manninen via Lazarus wrote: > In my tests Lazarus compiled with FPC trunk for GTK2 widgetset breaks > AnchorDocking completely. > Please see my comment here: > https://bugs.freepascal.org/view.php?id=32342#c102573 > Can others reproduce or is it just my config issue? It works here. Mattias From andrea.mauri.75 at gmail.com Tue Sep 5 14:41:09 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Tue, 5 Sep 2017 14:41:09 +0200 Subject: [Lazarus] custom thread reading file does not respond properly Message-ID: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> Dear all, I have an issue using threads on OSX. Basically I have a thread reading a file and looking for a string match. I have no problem on win and linux but on osx my thread updates the form but my application does not respond. I opened a topic on the forum (https://forum.lazarus.freepascal.org/index.php/topic,38146.0.html), I would like a more satisfactory answer. I am trying here. If possible, I would like to understand if this behaviour is related to OSX or SSD drive. If related to OSX I can simply add IFDEF DARWIN calling sleep? If it is related to SSD how can I manage it? Andrea Mauri From markMLl.lazarus at telemetry.co.uk Tue Sep 5 18:44:45 2017 From: markMLl.lazarus at telemetry.co.uk (Mark Morgan Lloyd) Date: Tue, 5 Sep 2017 16:44:45 +0000 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> Message-ID: On 05/09/17 13:00, Andrea Mauri via Lazarus wrote: > Dear all, > I have an issue using threads on OSX.Basically I have a thread reading a > file and looking for a string match.I have no problem on win and linux > but on osx my thread updates the form but my application does not > respond.I opened a topic on the forum > (https://forum.lazarus.freepascal.org/index.php/topic,38146.0.html), I > would like a more satisfactory answer. I am trying here. > If possible, I would like to understand if this behaviour is related to > OSX or SSD drive. If related to OSX I can simply add IFDEF DARWIN > calling sleep?If it is related to SSD how can I manage it? James Richters on the fpc-pascal ML commented on SSD commit problems in March. However I don't see why something like that should spill over to the UI. I notice that multiple people have already told you not to use a tight loop, and that applies to any OS. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] From andrea.mauri.75 at gmail.com Tue Sep 5 21:43:27 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Tue, 5 Sep 2017 21:43:27 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> Message-ID: > I notice that multiple people have already told you not to use a tight > loop, and that applies to any OS. > > > What exactly means tight? Is it something that I could measure in some way? The sample test I submitted to the forum is not my real code, that is a little more complex, and it does anything I do. What should I add? Since the same code works on win and linux (and as mattias wrote on the forum also on Mac). But not on my Mac (I can see the label changing but I cannot interact with my form), I supposed that it could be related to SSD drive. I didn't find a definitive answer. Anyway what is your suggestion? What should I add? -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascaldragon at googlemail.com Tue Sep 5 22:51:04 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Tue, 5 Sep 2017 22:51:04 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> Message-ID: <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> On 05.09.2017 21:43, Andrea Mauri via Lazarus wrote: > > I notice that multiple people have already told you not to use a > tight loop, and that applies to any OS. > > > > What exactly means tight? Is it something that I could measure in some way? > The sample test I submitted to the forum is not my real code, that is a > little more complex, and it does anything I do. What should I add? > Since the same code works on win and linux (and as mattias wrote on the > forum also on Mac). But not on my Mac (I can see the label changing but > I cannot interact with my form), I supposed that it could be related to > SSD drive. > I didn't find a definitive answer. > Anyway what is your suggestion? What should I add? It doesn't have to do with the SSD, this even happens on my old PowerBook which is much less powerful and doesn't even have an SSD (though I still plan to change that, mind you :P ). It is however solved if you add a "Yield;" after the Synchronize call. So my suspicion is that the scheduling of Mac OS X is somehow messing things up. Either the scheduling is favoring the one thread while it shouldn't (though even reducing the priority doesn't help) or the UI framework of Mac OS X (and whatever else is involved in the main thread) is so heavy weight that the timeslice of the mainthread is used up more often than not thus leading to the read thread being scheduled much more often. By using Yield (or also Sleep(), but Yield is without any pause) the thread is explicitly giving up its timeslice and that seems to be enough here... Sidenote: you might want to change your code a bit so that it looks like this: === code begin === TMyThread = class private fStatusMessage: String; procedure DoStatusEvent; // this will be passed to DoSynchronize procedure StatusEvent(const aStatus: String); // this will set fStatusMessage and call Synchronize ... end; procedure TMyThread.StatusEvent(const aStatus: String); begin fStatusMessage := aStatus; Synchronize(@DoStatusEvent); //Yield; // <- you can add this here end; === code end === This is a bit cleaner as it keeps changes to the status handling in one location. :) Regards, Sven From andrea.mauri.75 at gmail.com Wed Sep 6 11:31:26 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Wed, 6 Sep 2017 11:31:26 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> Message-ID: <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto: > > It is however solved if you add a "Yield;" after the Synchronize call. > So my suspicion is that the scheduling of Mac OS X is somehow messing > things up. Either the scheduling is favoring the one thread while it > shouldn't (though even reducing the priority doesn't help) or the UI > framework of Mac OS X (and whatever else is involved in the main thread) > is so heavy weight that the timeslice of the mainthread is used up more > often than not thus leading to the read thread being scheduled much more > often. > By using Yield (or also Sleep(), but Yield is without any pause) the > thread is explicitly giving up its timeslice and that seems to be enough > here... > I changed the code following your hints and I added Yield. This is not enough, it seems that the application is a little bit more responding (I can click on Tedit and after seconds the text is highlighted) but not enough to be usable. Actually for me it works only if I add at least Sleep(1). It is a pity that there is not a unique solution. From el.es.cr at gmail.com Wed Sep 6 16:26:32 2017 From: el.es.cr at gmail.com (el es) Date: Wed, 6 Sep 2017 15:26:32 +0100 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: > Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto: >> >> It is however solved if you add a "Yield;" after the Synchronize >> call. So my suspicion is that the scheduling of Mac OS X is somehow >> messing things up. Either the scheduling is favoring the one thread >> while it shouldn't (though even reducing the priority doesn't help) >> or the UI framework of Mac OS X (and whatever else is involved in >> the main thread) is so heavy weight that the timeslice of the >> mainthread is used up more often than not thus leading to the read >> thread being scheduled much more often. By using Yield (or also >> Sleep(), but Yield is without any pause) the thread is explicitly >> giving up its timeslice and that seems to be enough here... >> > > I changed the code following your hints and I added Yield. This is > not enough, it seems that the application is a little bit more > responding (I can click on Tedit and after seconds the text is > highlighted) but not enough to be usable. Actually for me it works > only if I add at least Sleep(1). It is a pity that there is not a > unique solution. Can you try ThreadSwitch after Sleep ? while (not Terminated) do begin if eof(f) then reset(f); ReadLn(f, newStatus); if NewStatus <> fStatusText then begin fStatusText := newStatus; //Queue(@ShowStatus); Synchronize(@Showstatus); Sleep(5); ThreadSwitch; /// <<<< end else // also you need to cover what happens in ANY OTHER outcome of any test, e.g. ThreadSwitch; // because if NewStatus = fStatusText, you will IMMEDIATELY jump to the first instruction of the thread // so adding the ThreadSwitch at the very end of the loop, you give the rest of the application (the main thread) a chance to // actually do anything end; Thread.Execute will execute ALL THE TIME if you don't yield/threadswitch in some code path, and WILL saturate your CPU. -l, From el.es.cr at gmail.com Wed Sep 6 16:45:39 2017 From: el.es.cr at gmail.com (el es) Date: Wed, 6 Sep 2017 15:45:39 +0100 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: On 06/09/17 15:26, el es wrote: > On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: >> Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto: >>> >>> It is however solved if you add a "Yield;" after the Synchronize >>> call. So my suspicion is that the scheduling of Mac OS X is somehow >>> messing things up. Either the scheduling is favoring the one thread >>> while it shouldn't (though even reducing the priority doesn't help) >>> or the UI framework of Mac OS X (and whatever else is involved in >>> the main thread) is so heavy weight that the timeslice of the >>> mainthread is used up more often than not thus leading to the read >>> thread being scheduled much more often. By using Yield (or also >>> Sleep(), but Yield is without any pause) the thread is explicitly >>> giving up its timeslice and that seems to be enough here... >>> >> >> I changed the code following your hints and I added Yield. This is >> not enough, it seems that the application is a little bit more >> responding (I can click on Tedit and after seconds the text is >> highlighted) but not enough to be usable. Actually for me it works >> only if I add at least Sleep(1). It is a pity that there is not a >> unique solution. > > Can you try ThreadSwitch after Sleep ? > > while (not Terminated) do > begin > if eof(f) then > reset(f); > ReadLn(f, newStatus); > if NewStatus <> fStatusText then > begin > fStatusText := newStatus; > //Queue(@ShowStatus); > Synchronize(@Showstatus); > Sleep(5); > ThreadSwitch; /// <<<< > end > else // also you need to cover what happens in ANY OTHER outcome of any test, e.g. > ThreadSwitch; > // because if NewStatus = fStatusText, you will IMMEDIATELY jump to the first instruction of the thread > // so adding the ThreadSwitch at the very end of the loop, you give the rest of the application (the main thread) a chance to > // actually do anything > end; > > Thread.Execute will execute ALL THE TIME if you don't yield/threadswitch in some code path, and WILL saturate your CPU. > > -l, > In addition to why this isn't a problem on Windows or Linux: they have supposedly better schedulers... but if not all codepaths on a thread are covered to give some time to main thread, try to imagine what happens: - could the un-yielded code path lead to over-zealous enqueuing of the ShowStatus routine? - if yes, what would happen in such case? From andrea.mauri.75 at gmail.com Wed Sep 6 16:59:32 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Wed, 6 Sep 2017 16:59:32 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: 2017-09-06 16:26 GMT+02:00 el es via Lazarus : > > Can you try ThreadSwitch after Sleep ? > > while (not Terminated) do > begin > if eof(f) then > reset(f); > ReadLn(f, newStatus); > if NewStatus <> fStatusText then > begin > fStatusText := newStatus; > //Queue(@ShowStatus); > Synchronize(@Showstatus); > Sleep(5); > ThreadSwitch; /// <<<< > end > else // also you need to cover what happens in ANY OTHER outcome of > any test, e.g. > ThreadSwitch; > // because if NewStatus = fStatusText, you will IMMEDIATELY jump to > the first instruction of the thread > // so adding the ThreadSwitch at the very end of the loop, you give > the rest of the application (the main thread) a chance to > // actually do anything > end; > > Thread.Execute will execute ALL THE TIME if you don't yield/threadswitch > in some code path, and WILL saturate your CPU. > > Actually using sleep(1) I can interact with my application. ThreadSwitch does not introduce any change. If I use sleep(1) it works, if I don't use it but I use Yield or ThreadSwitch I cannot interact with my application. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascaldragon at googlemail.com Wed Sep 6 17:19:28 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 6 Sep 2017 17:19:28 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: Am 06.09.2017 16:48 schrieb "el es via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On 06/09/17 15:26, el es wrote: > > On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: > >> Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto: > >>> > >>> It is however solved if you add a "Yield;" after the Synchronize > >>> call. So my suspicion is that the scheduling of Mac OS X is somehow > >>> messing things up. Either the scheduling is favoring the one thread > >>> while it shouldn't (though even reducing the priority doesn't help) > >>> or the UI framework of Mac OS X (and whatever else is involved in > >>> the main thread) is so heavy weight that the timeslice of the > >>> mainthread is used up more often than not thus leading to the read > >>> thread being scheduled much more often. By using Yield (or also > >>> Sleep(), but Yield is without any pause) the thread is explicitly > >>> giving up its timeslice and that seems to be enough here... > >>> > >> > >> I changed the code following your hints and I added Yield. This is > >> not enough, it seems that the application is a little bit more > >> responding (I can click on Tedit and after seconds the text is > >> highlighted) but not enough to be usable. Actually for me it works > >> only if I add at least Sleep(1). It is a pity that there is not a > >> unique solution. > > > > Can you try ThreadSwitch after Sleep ? > > > > while (not Terminated) do > > begin > > if eof(f) then > > reset(f); > > ReadLn(f, newStatus); > > if NewStatus <> fStatusText then > > begin > > fStatusText := newStatus; > > //Queue(@ShowStatus); > > Synchronize(@Showstatus); > > Sleep(5); > > ThreadSwitch; /// <<<< > > end > > else // also you need to cover what happens in ANY OTHER outcome of any test, e.g. > > ThreadSwitch; > > // because if NewStatus = fStatusText, you will IMMEDIATELY jump to the first instruction of the thread > > // so adding the ThreadSwitch at the very end of the loop, you give the rest of the application (the main thread) a chance to > > // actually do anything > > end; > > > > Thread.Execute will execute ALL THE TIME if you don't yield/threadswitch in some code path, and WILL saturate your CPU. > > > > -l, > > > > In addition to why this isn't a problem on Windows or Linux: they have supposedly better schedulers... > > but if not all codepaths on a thread are covered to give some time to main thread, try to imagine what happens: > > - could the un-yielded code path lead to over-zealous enqueuing of the ShowStatus routine? > - if yes, what would happen in such case? Both Synchronize and Sleep already causes a thread switch (the former cause it will wait for the main thread to finish processing). Also I already suggested TThread.Yield which is the same as ThreadSwitch. And as he wrote the Sleep(1) solves the problem for him. It's a pity though that this seems to be necessary on Mac OS X :/ Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From el.es.cr at gmail.com Wed Sep 6 17:25:35 2017 From: el.es.cr at gmail.com (el es) Date: Wed, 6 Sep 2017 16:25:35 +0100 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: On 06/09/17 16:19, Sven Barth via Lazarus wrote: > Am 06.09.2017 16:48 schrieb "el es via Lazarus" >: >> - could the un-yielded code path lead to over-zealous enqueuing of the ShowStatus routine? >> - if yes, what would happen in such case? > > Both Synchronize and Sleep already causes a thread switch (the former cause it will wait for the main thread to finish processing). Also I already suggested TThread.Yield which is the same as ThreadSwitch. > And as he wrote the Sleep(1) solves the problem for him. > It's a pity though that this seems to be necessary on Mac OS X :/ > > Regards, > Sven It is neccessary in Windows for me too (but i have the opposite problem : the thread-processing can be a lot shorter - hardware communications - than the time slice of the main thread, giving several Queue() or Synchronize() calls as a result;) Because of that, I have to use a tthreadlist as a buffer between the thread and the main thread. The time where I was hunting an elusive problem that did not happen under debugger, is never lost ;) -l. From nc-gaertnma at netcologne.de Wed Sep 6 17:36:13 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 6 Sep 2017 17:36:13 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> Message-ID: <20170906173613.55d50e7f@limapholos.matflo.wg> On Wed, 6 Sep 2017 17:19:28 +0200 Sven Barth via Lazarus wrote: >[...] > Both Synchronize and Sleep already causes a thread switch (the former cause > it will wait for the main thread to finish processing). Also I already > suggested TThread.Yield which is the same as ThreadSwitch. > And as he wrote the Sleep(1) solves the problem for him. > It's a pity though that this seems to be necessary on Mac OS X :/ Note that his example works on my Mac with or without sleep. Maybe if Andrea posts his full example we may find out more. Mattias From andrea.mauri.75 at gmail.com Wed Sep 6 18:15:24 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Wed, 6 Sep 2017 18:15:24 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <20170906173613.55d50e7f@limapholos.matflo.wg> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> <20170906173613.55d50e7f@limapholos.matflo.wg> Message-ID: <2f06606c-faf5-9f70-66f5-4d3e04e68675@gmail.com> > Note that his example works on my Mac with or without > sleep. Maybe if Andrea posts his full example we may find out more. > > Mattias > Unfortunately I cannot post the real case, it is included in a bigger unit involving other stuffs. Anyway the example I posted is quite the same. In order to better clarify my issue: - I have to manage text files including some logical blocks (items), these files can be huge (gigabytes) and they can store millions of items (some file types define an item using a single line). My application deals with these files enabling the user to visualize the items in a grid and rapidly move along the file. I encounter it in two different threads: 1. a thread that I launch when the user load one of these files. This thread simply reads the file, counts the items and stores the position of the items (streambuffer positions). 2. a thread reading a file and looking for a substring. 1. source procedure TCountItemsThread.Execute; var streamreader: TStreamReader; streampos, streamsize: Int64; bufferpos, nitems: Integer; begin _itemfile:= TItemsFile.Create(_filename, _fileformat); try streamreader:= _itemfile._streamreader; streamreader.Reset; streamsize:= streamreader.BaseStream.Size; _itempos.Clear; _itembufpos.Clear; nitems:= 0; while not Terminated and not streamreader.Eof do begin // stores items source position in file as Position and BufferPosition streampos:= streamreader.Position; if streamreader.BufferRead < (BUFFER_SIZE - 1) then streampos:= streampos - (streamreader.BufferRead) else streampos:= streampos - (BUFFER_SIZE - 1); bufferpos:= streamreader.BufferPosition; if (bufferpos = 0) and (streampos > 0 ) then begin streampos:= streampos - (BUFFER_SIZE - 1); bufferpos:= BUFFER_SIZE - 1; end; if _itemsfile.nextItem then begin _itempos.Add(streampos); _itembufpos.Add(bufferpos); _progress:= round((streampos / streamsize) * 100); Inc(nitems); if (_itempos.Count mod 1000) = 0 then begin Synchronize(@CountingItems); end; end; end; Synchronize(@EndCountItems); finally _itemfile.Free; end; end; nextItem simply parse the file and move the stream to the next item position. If the file has single line items I cannot interact with my app even on win. 2. source procedure TFilterNameThread.Execute; var substr, str1: string; i, step, occurrences: Integer; clonedfile: TItemFile; begin // if substr is empty do not perform search FFindItems.Size:= FItemFile.CountItems; if Trim(FindString) = '' then begin for i:= 0 to FItemFile.CountItems - 1 do begin FFindItems[i]:= True; end; _itemidx:= FItemFile.CountItems; Synchronize(@ShowProgress); Exit; end; // store original FItemFile.Selected[] and sets FItemFile.Selected[] to False _itemidx:= 0; FFindItems.Clearall; Synchronize(@ShowProgress); clonedfile:= FItemFile.CloneFile; try step:= clonedfile.CountItems div 100; if step = 0 then step:= 1; substr:= FindString; if not CaseSensitive then substr:= upcase(substr); occurrences:= 0; while (not Terminated) and (_itemidx < clonedfile.CountItems) do begin if CheckAll or Selected[_itemidx] then begin str1:= clonedfile.ItemName[_itemidx]; if not CaseSensitive then str1:= upcase(str1); if Pos(substr, str1) > 0 then begin FFindItems[_itemidx]:= True; Synchronize(@ShowProgress); Inc(occurrences); end; end; if (_itemidx mod step) = (step - 1) then begin Sleep(5); Synchronize(@ShowProgress); end; Inc(_itemidx); end; Synchronize(@ShowProgress); finally clonedfile.Free; end; end; From andrea.mauri.75 at gmail.com Wed Sep 6 19:14:15 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Wed, 6 Sep 2017 19:14:15 +0200 Subject: [Lazarus] savedialog carbon osx Message-ID: Dear all, I have an issue with tsavedialog on OS X (laz 1.6.4, fps 3.0.2). If I execute the dialog and select a file in Documents folder then I execute again the dialog the filename is highlighted in the savedialog, I just press Save and the file name I messed up, the filename include the previous filename plus the new filename without path. In order to reproduce that just add a button a savedialog and a label to a form. procedure TForm1.Button1Click(Sender: TObject); begin if SaveDialog1.Execute then Label1.Caption:= SaveDialog1.FileName; end; A known bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascaldragon at googlemail.com Wed Sep 6 19:34:46 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 6 Sep 2017 19:34:46 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: <20170906173613.55d50e7f@limapholos.matflo.wg> References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> <20170906173613.55d50e7f@limapholos.matflo.wg> Message-ID: Am 06.09.2017 17:36 schrieb "Mattias Gaertner via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On Wed, 6 Sep 2017 17:19:28 +0200 > Sven Barth via Lazarus wrote: > > >[...] > > Both Synchronize and Sleep already causes a thread switch (the former cause > > it will wait for the main thread to finish processing). Also I already > > suggested TThread.Yield which is the same as ThreadSwitch. > > And as he wrote the Sleep(1) solves the problem for him. > > It's a pity though that this seems to be necessary on Mac OS X :/ > > Note that his example works on my Mac with or without > sleep. Maybe if Andrea posts his full example we may find out more. Maybe your file is not suitable? I used a /var/log/messages.log file from one of my Linux computers and with that I can reproduce it with the given code. Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.mauri.75 at gmail.com Wed Sep 6 19:45:19 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Wed, 6 Sep 2017 19:45:19 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> <20170906173613.55d50e7f@limapholos.matflo.wg> Message-ID: 2017-09-06 19:34 GMT+02:00 Sven Barth via Lazarus < lazarus at lists.lazarus-ide.org>: > Maybe your file is not suitable? I used a /var/log/messages.log file from > one of my Linux computers and with that I can reproduce it with the given > code. > > Regards, > Sven > > > They are plain text file. Attached one of them, I tested the application I reported on the forum with this one. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: nci_download_red.smi Type: application/smil Size: 1172 bytes Desc: not available URL: From aaa5500 at ya.ru Thu Sep 7 08:42:28 2017 From: aaa5500 at ya.ru (Alexey) Date: Thu, 7 Sep 2017 09:42:28 +0300 Subject: [Lazarus] crDrag cursor is now 2x bigger Message-ID: with crNoDrop cursor. On Linux gtk2 I see cursor is 2x-3x bigger than I seen it before, 2-3 months ago. -- Regards, Alexey From zeljko at holobit.net Thu Sep 7 09:02:33 2017 From: zeljko at holobit.net (Zeljko) Date: Thu, 07 Sep 2017 09:02:33 +0200 Subject: [Lazarus] crDrag cursor is now 2x bigger In-Reply-To: References: Message-ID: <59B0EF09.7080204@holobit.net> On 09/07/2017 08:42 AM, Alexey via Lazarus wrote: > with crNoDrop cursor. On Linux gtk2 I see cursor is 2x-3x bigger than I > seen it before, 2-3 months ago. > Maybe not related but this is my yesterday post to lazdevel list: cursorimage.inc TCursorImage.LoadFromResourceHandle() Line 95 IconEntry.bWidth := DirEntry^.wWidth; IconEntry.bHeight := DirEntry^.wHeight; IconEntry members are byte, but DirEntry members are word, so range error occurs. Note that range error does not occur with fpc-3.0.2 , but it happens with 3.0.4rc1. So, maybe cast can fix your problem: IconEntry.bWidth := Byte(DirEntry^.wWidth); IconEntry.bHeight := Byte(DirEntry^.wHeight); zeljko From lazarus at kluug.net Thu Sep 7 09:09:14 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Thu, 7 Sep 2017 09:09:14 +0200 Subject: [Lazarus] crDrag cursor is now 2x bigger In-Reply-To: References: Message-ID: <9a5e4431-2b74-d4b5-bee2-2c1ff607fb04@kluug.net> Michl added high-resolution cursors recently. Obviously Gtk2 picks up the wrong size. Win32 works fine. Ondrej From mlnglsts at bgss.hu Thu Sep 7 15:03:30 2017 From: mlnglsts at bgss.hu (Gabor Boros) Date: Thu, 7 Sep 2017 15:03:30 +0200 Subject: [Lazarus] Strange anchoring with a ScrollBox, Panel, Label combination Message-ID: <9383f3e9-6ed8-9e1f-ae65-33365941fb73@bgss.hu> Hi All, See the attached example project. If a Label wider than the owner Panel's width its (the owner Panel) resized to Label's width and the horizontal scrollbar appears in the ScrollBox. From my POV this is a bug. I am wrong? Gabor -------------- next part -------------- A non-text attachment was scrubbed... Name: ScrollBox_Panel_Label.png Type: image/png Size: 15066 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ScrollBox_Panel_Label.tar.gz Type: application/x-gzip Size: 1711 bytes Desc: not available URL: From m-w-vogel at gmx.de Thu Sep 7 15:57:29 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Thu, 7 Sep 2017 15:57:29 +0200 Subject: [Lazarus] crDrag cursor is now 2x bigger In-Reply-To: <9a5e4431-2b74-d4b5-bee2-2c1ff607fb04@kluug.net> References: <9a5e4431-2b74-d4b5-bee2-2c1ff607fb04@kluug.net> Message-ID: <56bf9dc0-016d-5ded-9b5a-51064ad0aeb0@gmx.de> Am 07.09.2017 um 09:09 schrieb Ondrej Pokorny via Lazarus: > Michl added high-resolution cursors recently. Obviously Gtk2 picks up > the wrong size. Win32 works fine. This is a inconsistency between Linux and Windows. While on Windows the cursors are scaled after the DPI setting is changed, on Linux the cursors stays small. The cursors taken from the system are further small. The cursors taken from resourse are wrongly scaled. Will see. Michl From m-w-vogel at gmx.de Thu Sep 7 16:28:24 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Thu, 7 Sep 2017 16:28:24 +0200 Subject: [Lazarus] crDrag cursor is now 2x bigger In-Reply-To: <56bf9dc0-016d-5ded-9b5a-51064ad0aeb0@gmx.de> References: <9a5e4431-2b74-d4b5-bee2-2c1ff607fb04@kluug.net> <56bf9dc0-016d-5ded-9b5a-51064ad0aeb0@gmx.de> Message-ID: <210bcd41-9105-9062-f94b-8d00acf84097@gmx.de> Am 07.09.2017 um 15:57 schrieb Michael W. Vogel via Lazarus: > This is a inconsistency between Linux and Windows. While on Windows > the cursors are scaled after the DPI setting is changed, on Linux the > cursors stays small. The cursors taken from the system are further > small. The cursors taken from resourse are wrongly scaled. Damn, I'm wrong. This was the behaviour after switching from 120 to 196DPI. Seems so, not all settings were correctly switched. After a restart of that OS, revision 55794 works correct here (all cursors scaled, just crNo is to little, see test app on bugtracker): 64bit Linux Mint KDE 17.3 Lazarus 1.9.0 r55794 FPC 3.0.2 x86_64-linux-gtk2 Well, I think lets discuss it here: https://bugs.freepascal.org/view.php?id=32385 Michl From aaa5500 at ya.ru Fri Sep 8 08:49:47 2017 From: aaa5500 at ya.ru (Alexey) Date: Fri, 8 Sep 2017 09:49:47 +0300 Subject: [Lazarus] TreeView.SortType has no effect on adding Message-ID: <49f8bc65-0269-d0fb-bd48-d82afaadcfb9@ya.ru> not sure it is a bug. set Tree.SortType to stText. tree is sorted OK. now clear it, add many new items ==> items not sorted. so AlphaSort not called after adding items. -- Regards, Alexey From mailinglists at geldenhuys.co.uk Fri Sep 8 10:48:38 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 8 Sep 2017 09:48:38 +0100 Subject: [Lazarus] Why is there no announcement of Lazarus event Message-ID: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> Just wondering? Or is it still coming? Regards, Graeme From marc at dommelstein.nl Fri Sep 8 14:03:29 2017 From: marc at dommelstein.nl (Marc Weustink) Date: Fri, 08 Sep 2017 14:03:29 +0200 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> Message-ID: <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> Which event are you referring to? Marc On September 8, 2017 10:48:38 AM GMT+02:00, Graeme Geldenhuys via Lazarus wrote: > >Just wondering? Or is it still coming? > > >Regards, > Graeme > >-- >_______________________________________________ >Lazarus mailing list >Lazarus at lists.lazarus-ide.org >https://lists.lazarus-ide.org/listinfo/lazarus From mailinglists at geldenhuys.co.uk Fri Sep 8 14:21:02 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 8 Sep 2017 13:21:02 +0100 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> Message-ID: On 2017-09-08 13:03, Marc Weustink via Lazarus wrote: > Which event are you referring to? http://www.blaisepascal.eu/agenda/lazarus_conference.php Dated for 14 October 2017. Regards, Graeme From marc at dommelstein.nl Fri Sep 8 18:16:35 2017 From: marc at dommelstein.nl (Marc Weustink) Date: Fri, 08 Sep 2017 18:16:35 +0200 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> Message-ID: <4907D613-DE20-42D9-A04C-C665F7FD8DBC@dommelstein.nl> Some members of the Lazarus team have contacts with blaisepascal, but we are not connected. Some of the Lazarus members might have a talk but the agenda is mostly unknown yet. The link you gave is setup 2 days ago, the same time the editor contacted me for some ideas. Imo to early for an announcement Marc On September 8, 2017 2:21:02 PM GMT+02:00, Graeme Geldenhuys via Lazarus wrote: >On 2017-09-08 13:03, Marc Weustink via Lazarus wrote: >> Which event are you referring to? > > >http://www.blaisepascal.eu/agenda/lazarus_conference.php > >Dated for 14 October 2017. > >Regards, > Graeme > > >-- >_______________________________________________ >Lazarus mailing list >Lazarus at lists.lazarus-ide.org >https://lists.lazarus-ide.org/listinfo/lazarus From mailinglists at geldenhuys.co.uk Fri Sep 8 18:40:48 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 8 Sep 2017 17:40:48 +0100 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: <4907D613-DE20-42D9-A04C-C665F7FD8DBC@dommelstein.nl> References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> <4907D613-DE20-42D9-A04C-C665F7FD8DBC@dommelstein.nl> Message-ID: On 2017-09-08 17:16, Marc Weustink via Lazarus wrote: > The link you gave is setup 2 days ago, the same time the editor contacted me for some ideas. > > Imo to early for an announcement Fair enough. I was contacted yesterday - to be one of the presenters, but unfortunately it was too short notice for me (even though I would have loved to go). :-( I didn't realise the idea of having a Conference came about so late. They [Blaise Pascal] really should plan ahead better. The same issue "too short notice" might now apply to somebody that wants to attend the conference too. :-/ I do appreciate Blaise Pascal for wanting to promote FPC and Lazarus though. It's high time somebody does! Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From md at delfire.net Fri Sep 8 19:06:45 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Fri, 8 Sep 2017 14:06:45 -0300 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> <4907D613-DE20-42D9-A04C-C665F7FD8DBC@dommelstein.nl> Message-ID: On Fri, Sep 8, 2017 at 1:40 PM, Graeme Geldenhuys via Lazarus wrote: > > I didn't realise the idea of having a Conference came about so late. They > [Blaise Pascal] really should plan ahead better. The same issue "too short > notice" might now apply to somebody that wants to attend the conference too. > :-/ I agree. I know that could be difficult, but plan ahead (months?) would be better. I'm living on Brazil but almost every year I travel to abroad. If I know about these conferences at the future, I would participated. > I do appreciate Blaise Pascal for wanting to promote FPC and Lazarus though. > It's high time somebody does! +1 Best regards, Marcos Douglas From andrea.mauri.75 at gmail.com Sat Sep 9 10:30:30 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Sat, 9 Sep 2017 10:30:30 +0200 Subject: [Lazarus] custom thread reading file does not respond properly In-Reply-To: References: <0bfe2ac7-e0f5-b926-1620-49471e04efb8@gmail.com> <9c9de38a-bdd8-8c3e-f324-43258ce9eb25@googlemail.com> <8d7c6e7a-1808-ea15-0720-95e9439a1c52@gmail.com> <20170906173613.55d50e7f@limapholos.matflo.wg> Message-ID: <254b792c-703f-63d1-e8f0-903c25e37347@gmail.com> Il 06/09/2017 19:45, Andrea Mauri ha scritto: > > 2017-09-06 19:34 GMT+02:00 Sven Barth via Lazarus > >: > > Maybe your file is not suitable? I used a /var/log/messages.log file > from one of my Linux computers and with that I can reproduce it with > the given code. > > Regards, > Sven > > > They are plain text file. Attached one of them, I tested the application > I reported on the forum with this one. > As far as I understood. This behaviour is quite unpredictable, the thread seems to work properly or not with different solutions. Sometimes it works on osx sometimes not. I have to admit that I would prefer that it was a bug or an error in my code. Do you have any suggestion to improve my code (even with ifdef) in order to be able to deploy an application that works on lin/win/osx? From nc-gaertnma at netcologne.de Sat Sep 9 12:16:16 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sat, 9 Sep 2017 12:16:16 +0200 Subject: [Lazarus] TreeView.SortType has no effect on adding In-Reply-To: <49f8bc65-0269-d0fb-bd48-d82afaadcfb9@ya.ru> References: <49f8bc65-0269-d0fb-bd48-d82afaadcfb9@ya.ru> Message-ID: <20170909121616.7a787928@limapholos.matflo.wg> On Fri, 8 Sep 2017 09:49:47 +0300 Alexey via Lazarus wrote: > not sure it is a bug. set Tree.SortType to stText. tree is sorted OK. > now clear it, add many new items ==> items not sorted. so AlphaSort not > called after adding items. This is Delphi compatible. I will add it to the documentation. Mattias From j.w.dietrich at medizinische-kybernetik.de Sat Sep 9 14:10:35 2017 From: j.w.dietrich at medizinische-kybernetik.de (Johannes W. Dietrich) Date: Sat, 9 Sep 2017 14:10:35 +0200 Subject: [Lazarus] Why is there no announcement of Lazarus event (Graeme Geldenhuys) In-Reply-To: References: Message-ID: <560B1A0C-428A-4657-9650-E8CE48DA8C36@medizinische-kybernetik.de> See http://wiki.lazarus.freepascal.org/Conferences_and_Events for an (almost) up-to-date list of events. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- PD Dr. med. Johannes W. Dietrich -- Laboratory XU44, Endocrine Research -- Medical Hospital I, Bergmannsheil University Hospitals -- Ruhr University of Bochum -- Buerkle-de-la-Camp-Platz 1, D-44789 Bochum, NRW, Germany -- Phone: +49:234:302-6400, Fax: +49:234:302-6403 -- eMail: "johannes.dietrich at ruhr-uni-bochum.de" -- http://www.thyreologie.com.de -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaa5500 at ya.ru Mon Sep 11 20:29:12 2017 From: aaa5500 at ya.ru (Alexey) Date: Mon, 11 Sep 2017 21:29:12 +0300 Subject: [Lazarus] not optimal code (need Move) in RegExpr unit Message-ID: function StrPCopy (Dest: PRegExprChar; const Source: RegExprString): PRegExprChar; var i, Len : PtrInt; begin Len := length (Source); //###0.932 for i := 1 to Len do Dest [i - 1] := Source [i]; Dest [Len] := #0; Result := Dest; end; { of function StrPCopy --------------------------------------------------------------} function StrLCopy (Dest, Source: PRegExprChar; MaxLen: PtrUInt): PRegExprChar; var i: PtrInt; begin for i := 0 to MaxLen - 1 do Dest [i] := Source [i]; Result := Dest; end; { of function StrLCopy --------------------------------------------------------------} -- Regards, Alexey From aaa5500 at ya.ru Mon Sep 11 22:19:20 2017 From: aaa5500 at ya.ru (Alexey) Date: Mon, 11 Sep 2017 23:19:20 +0300 Subject: [Lazarus] Idea of TFormTitle Message-ID: Maybe ok idea? make class TFormTitle. it is some small (by Y) form which is embedded into Form (form which has FormTitle property set). When prop FormTitle set, OS border hides and obj of FormTitle inserted into TOP of form (it looks like OS window caption). When this FormTitle is used, form has LCL border. default FormTitle can be simple (x, min, max +icon +title). OS border is hidden. It is ok idea? -- Regards, Alexey From badsectoracula at gmail.com Mon Sep 11 23:08:53 2017 From: badsectoracula at gmail.com (Kostas Michalopoulos) Date: Tue, 12 Sep 2017 00:08:53 +0300 Subject: [Lazarus] Idea of TFormTitle In-Reply-To: References: Message-ID: Why would you want that? On Mon, Sep 11, 2017 at 11:19 PM, Alexey via Lazarus < lazarus at lists.lazarus-ide.org> wrote: > Maybe ok idea? make class TFormTitle. it is some small (by Y) form which > is embedded into Form (form which has FormTitle property set). When prop > FormTitle set, OS border hides and obj of FormTitle inserted into TOP of > form (it looks like OS window caption). > > When this FormTitle is used, form has LCL border. default FormTitle can be > simple (x, min, max +icon +title). OS border is hidden. It is ok idea? > > -- > Regards, > Alexey > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaa5500 at ya.ru Mon Sep 11 23:12:54 2017 From: aaa5500 at ya.ru (Alexey) Date: Tue, 12 Sep 2017 00:12:54 +0300 Subject: [Lazarus] Idea of TFormTitle In-Reply-To: References: Message-ID: <580d7f46-e306-f41d-09e6-9c5d1b480ed0@ya.ru> >Why would you want that? LCL can have global var for FormTitle. this var can be used by all forms. so all forms will be "themed". if programmer changes this glob var (like we can do with THintWindow) then all windows have themed window title. -- Regards, Alexey From aaa5500 at ya.ru Tue Sep 12 20:01:13 2017 From: aaa5500 at ya.ru (Alexey) Date: Tue, 12 Sep 2017 21:01:13 +0300 Subject: [Lazarus] FPReport file names Message-ID: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Hi It is new. Please rename (it's easy for new component) all files: usually its good with one prefix. E.g. fprep_*.*. And form resources: 18 LFM files, 29 pas files. Pls rename with prefix too, to avoid LFM conflicts. -- Regards, Alexey From michael at freepascal.org Tue Sep 12 20:07:58 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 12 Sep 2017 20:07:58 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: On Tue, 12 Sep 2017, Alexey via Lazarus wrote: > Hi > > It is new. Please rename (it's easy for new component) all files: > usually its good with one prefix. E.g. fprep_*.*. Definitely not. Michael. From aaa5500 at ya.ru Tue Sep 12 20:21:15 2017 From: aaa5500 at ya.ru (Alexey) Date: Tue, 12 Sep 2017 21:21:15 +0300 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: >Definitely not. It is good to do (some users will see filename conflicts in big apps). no big apps ready on FPRep yet. -- Regards, Alexey From michael at freepascal.org Tue Sep 12 20:25:02 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 12 Sep 2017 20:25:02 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: On Tue, 12 Sep 2017, Alexey via Lazarus wrote: >> Definitely not. > > It is good to do (some users will see filename conflicts in big apps). > no big apps ready on FPRep yet. Why would people see filename conflicts ? None of these files exist yet. And there are already apps in production using fpreport. Michael. From aaa5500 at ya.ru Tue Sep 12 20:32:57 2017 From: aaa5500 at ya.ru (Alexey) Date: Tue, 12 Sep 2017 21:32:57 +0300 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: On 12.09.2017 21:25, Michael Van Canneyt via Lazarus wrote: > Why would people see filename conflicts ? None of these files exist yet. because files like dlginputcombo.pp, fradbfdata.*, frmresizeelements.* may exist in BIG app. -- Regards, Alexey From michael at freepascal.org Tue Sep 12 20:36:13 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 12 Sep 2017 20:36:13 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: On Tue, 12 Sep 2017, Alexey via Lazarus wrote: > On 12.09.2017 21:25, Michael Van Canneyt via Lazarus wrote: >> Why would people see filename conflicts ? None of these files exist yet. > > because files like > > dlginputcombo.pp, fradbfdata.*, frmresizeelements.* may exist in BIG app. The ones without prefix can indeed be prefixed. Michael. From mailinglists at geldenhuys.co.uk Wed Sep 13 10:06:18 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 09:06:18 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> Message-ID: <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> On 2017-09-12 19:01, Alexey via Lazarus wrote: > It is new. Please rename (it's easy for new component) all files: > usually its good with one prefix. E.g. fprep_*.*. hahaha... I had the units like that, using underscores. eg: fpreport_export_aggpas.pas, fpreport_export_fpimage.pas etc. Michael didn't like it, so it got renamed before it went into FPC Trunk. :) The LCL related units could be prefixed though, as Michael mentioned. Then again, maybe it's time FPC starts making use of namespaces and dotted unit names? Just a thought. In Delphi it is actually pretty useful and also stops unit name conflicts. FPC does need a bit more work though to fully support namespaces - at least the way Delphi uses it. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From michael at freepascal.org Wed Sep 13 10:44:23 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 10:44:23 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-12 19:01, Alexey via Lazarus wrote: >> It is new. Please rename (it's easy for new component) all files: >> usually its good with one prefix. E.g. fprep_*.*. > > hahaha... I had the units like that, using underscores. eg: > fpreport_export_aggpas.pas, fpreport_export_fpimage.pas etc. Michael > didn't like it, so it got renamed before it went into FPC Trunk. :) > > The LCL related units could be prefixed though, as Michael mentioned. They should be, since some of the names used in the designer are indeed too generic. > Then again, maybe it's time FPC starts making use of namespaces and > dotted unit names? Just a thought. In Delphi it is actually pretty > useful and also stops unit name conflicts. FPC does need a bit more work > though to fully support namespaces - at least the way Delphi uses it. As long as there are no command-line switch and directive for setting namespaces, they are completely useless. And even with them, the benefit is doubtful. The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. And even with the command-line switch, the 'namespaces stop unit name conflicts' argument is of course complete nonsense. Whoever originally tossed that argument into the world needs to be ridiculed for either being stupid or not thinking his argument through. because a) I could equally easy decide to use the same namespace as someone else. (Yes, I have a notoriously bad character) b) If you use the namespace param too much, you are in trouble anyway. Imagine: web.utils.pas os.utils.pas and in my project I have (I love to use the namespace param) uses utils; And now I compile with a (hypothetical) /NSweb /NSos -> problem. I tested in Delphi: c:\Temp>dcc32 /NSos /NSweb testns.dpr Embarcadero Delphi for Win32 compiler version 30.0 Copyright (c) 1983,2015 Embarcadero Technologies, Inc. os.utils.pas(14) testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' testns.dpr(7) webfunction is in the web.utils.pas unit. So, to disambiguate, that forces me to write uses web.utils; in which case I can just as well have written uses webutils; So we're back to square 1. Michael. From mlnglsts at bgss.hu Wed Sep 13 10:51:25 2017 From: mlnglsts at bgss.hu (Gabor Boros) Date: Wed, 13 Sep 2017 10:51:25 +0200 Subject: [Lazarus] LazReport - Issues 26971 and 30466 Message-ID: <8068ca6b-eb58-6df4-f13c-86e31709f3ef@bgss.hu> Hi All, https://bugs.freepascal.org/view.php?id=26971 ~3 years later. Any idea? https://bugs.freepascal.org/view.php?id=30466 The KeepChild feature is very important from my POV. Please review the patch. (I have not tried yet.) Gabor From nc-gaertnma at netcologne.de Wed Sep 13 11:13:16 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 11:13:16 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: <20170913111316.2d901692@limapholos.matflo.wg> On Wed, 13 Sep 2017 10:44:23 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: >[...] > As long as there are no command-line switch and directive for setting > namespaces, they are completely useless. And even with them, the benefit is > doubtful. > > The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. It's a little bit better than zero. For example shorter uses clause. > And even with the command-line switch, the 'namespaces stop unit name conflicts' > argument is of course complete nonsense. True. >[...] > I tested in Delphi: > > c:\Temp>dcc32 /NSos /NSweb testns.dpr > Embarcadero Delphi for Win32 compiler version 30.0 > Copyright (c) 1983,2015 Embarcadero Technologies, Inc. > os.utils.pas(14) > testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' > testns.dpr(7) > > webfunction is in the web.utils.pas unit. Did you add "uses utils"? There is no switch to use "web.*" like in Java. > So, to disambiguate, that forces me to write > > uses web.utils; "uses utils" should be enough. Mattias From pascaldragon at googlemail.com Wed Sep 13 11:19:58 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 13 Sep 2017 11:19:58 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: Am 13.09.2017 10:45 schrieb "Michael Van Canneyt via Lazarus" < lazarus at lists.lazarus-ide.org>: > > > > On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > >> On 2017-09-12 19:01, Alexey via Lazarus wrote: >>> >>> It is new. Please rename (it's easy for new component) all files: >>> usually its good with one prefix. E.g. fprep_*.*. >> >> >> hahaha... I had the units like that, using underscores. eg: fpreport_export_aggpas.pas, fpreport_export_fpimage.pas etc. Michael didn't like it, so it got renamed before it went into FPC Trunk. :) >> >> The LCL related units could be prefixed though, as Michael mentioned. > > > They should be, since some of the names used in the designer are indeed too > generic. > > >> Then again, maybe it's time FPC starts making use of namespaces and dotted unit names? Just a thought. In Delphi it is actually pretty useful and also stops unit name conflicts. FPC does need a bit more work though to fully support namespaces - at least the way Delphi uses it. > > > As long as there are no command-line switch and directive for setting namespaces, they are completely useless. And even with them, the benefit is > doubtful. > > The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. > The "." allows for a nicer disambiguation between what's the prefix and what's the remainder. Granted, that can be done with "_" as well, but in my personal opinion a "." simply looks nicer. :) Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From wkitty42 at windstream.net Wed Sep 13 11:22:27 2017 From: wkitty42 at windstream.net (wkitty42 at windstream.net) Date: Wed, 13 Sep 2017 05:22:27 -0400 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913111316.2d901692@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913111316.2d901692@limapholos.matflo.wg> Message-ID: On 09/13/2017 05:13 AM, Mattias Gaertner via Lazarus wrote: > On Wed, 13 Sep 2017 10:44:23 +0200 (CEST) > Michael Van Canneyt via Lazarus wrote: >> [...] >> I tested in Delphi: >> >> c:\Temp>dcc32 /NSos /NSweb testns.dpr >> Embarcadero Delphi for Win32 compiler version 30.0 >> Copyright (c) 1983,2015 Embarcadero Technologies, Inc. >> os.utils.pas(14) >> testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' >> testns.dpr(7) >> >> webfunction is in the web.utils.pas unit. > > Did you add "uses utils"? ummm... On 09/13/2017 04:44 AM, Michael Van Canneyt via Lazarus wrote: [...] > Imagine: > > web.utils.pas > os.utils.pas > > and in my project I have (I love to use the namespace param) > > *uses utils;* > > And now I compile with a (hypothetical) /NSweb /NSos -> problem. ;) -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.* From michael at freepascal.org Wed Sep 13 11:28:55 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 11:28:55 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <20170913111316.2d901692@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913111316.2d901692@limapholos.matflo.wg> Message-ID: On Wed, 13 Sep 2017, Mattias Gaertner via Lazarus wrote: > On Wed, 13 Sep 2017 10:44:23 +0200 (CEST) > Michael Van Canneyt via Lazarus wrote: > >> [...] >> As long as there are no command-line switch and directive for setting >> namespaces, they are completely useless. And even with them, the benefit is >> doubtful. >> >> The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. > > It's a little bit better than zero. For example shorter uses clause. Without using a switch to set namespaces ? Please Explain ? >> os.utils.pas(14) >> testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' >> testns.dpr(7) >> >> webfunction is in the web.utils.pas unit. > > Did you add "uses utils"? Yes, obviously. Here is the test program: program testns; uses utils; begin writeln(webfunction); end. unit web.utils; interface function webfunction : string; implementation function webfunction : string; begin Result:='web'; end; end. unit os.utils; interface function osfunction : string; implementation function osfunction : string; begin Result:='os'; end; end. > There is no switch to use "web.*" like in Java. In Delphi there is: /NSweb. But as soon as you use 2 namespaces (/NSos /NSWeb), you are stuck. As you see from the output I posted, it compiles first os.utils and uses that to satisfy the "uses utils;". To be complete: it depends on the order of the NS switches, if you reverse the order, it will work - but that doesn't help if you have a big project which has many units using utils from one or the other namespace. The first one wins. >> So, to disambiguate, that forces me to write >> >> uses web.utils; > > "uses utils" should be enough. As I demonstrated: it clearly is not. I carefully tested everything before posting my remark. Michael. From michael at freepascal.org Wed Sep 13 11:30:40 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 11:30:40 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: On Wed, 13 Sep 2017, Sven Barth via Lazarus wrote: >> >> As long as there are no command-line switch and directive for setting > namespaces, they are completely useless. And even with them, the benefit is >> doubtful. >> >> The benefit of writing fpreport.exporthtml versus fpreportexporthtml is > zero. >> > > The "." allows for a nicer disambiguation between what's the prefix and > what's the remainder. Oh please... > Granted, that can be done with "_" as well, but in my > personal opinion a "." simply looks nicer. :) It's an extra character. When using CamelCase properly, you don't need _ or . at all. Michael. From el.es.cr at gmail.com Wed Sep 13 11:35:09 2017 From: el.es.cr at gmail.com (el es) Date: Wed, 13 Sep 2017 10:35:09 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: On 13/09/17 10:19, Sven Barth via Lazarus wrote: > Am 13.09.2017 10:45 schrieb "Michael Van Canneyt via Lazarus" >> The benefit of writing fpreport.exporthtml versus >> fpreportexporthtml is zero. >> > > The "." allows for a nicer disambiguation between what's the prefix > and what's the remainder. Granted, that can be done with "_" as well, > but in my personal opinion a "." simply looks nicer. :) > > Regards, Sven >From POV of an 'ordinary user' I came to say the same thing > fpreportexporthtml > fpreport.exporthtml is exactly only 1 character longer but the separator (. or _) makes a lot of difference... -L. From nc-gaertnma at netcologne.de Wed Sep 13 11:40:23 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 11:40:23 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: <20170913114023.225c2e8c@limapholos.matflo.wg> On Wed, 13 Sep 2017 11:19:58 +0200 Sven Barth via Lazarus wrote: >[...] > The "." allows for a nicer disambiguation between what's the prefix and > what's the remainder. Granted, that can be done with "_" as well, but in my > personal opinion a "." simply looks nicer. :) I don't get why disambiguity is "nicer". The compiler has to backstep and try all combinations to find out what a.b.c means. Mattias From lazarus at kluug.net Wed Sep 13 11:40:52 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 11:40:52 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> On 13.09.2017 10:44, Michael Van Canneyt via Lazarus wrote: > > On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > >> On 2017-09-12 19:01, Alexey via Lazarus wrote: >>> It is new. Please rename (it's easy for new component) all files: >>> usually its good with one prefix. E.g. fprep_*.*. >> >> hahaha... I had the units like that, using underscores. eg: >> fpreport_export_aggpas.pas, fpreport_export_fpimage.pas etc. Michael >> didn't like it, so it got renamed before it went into FPC Trunk. :) >> >> The LCL related units could be prefixed though, as Michael mentioned. > > They should be, since some of the names used in the designer are > indeed too > generic. > >> Then again, maybe it's time FPC starts making use of namespaces and >> dotted unit names? Just a thought. In Delphi it is actually pretty >> useful and also stops unit name conflicts. FPC does need a bit more >> work though to fully support namespaces - at least the way Delphi >> uses it. > > As long as there are no command-line switch and directive for setting > namespaces, they are completely useless. And even with them, the > benefit is > doubtful. > > The benefit of writing fpreport.exporthtml versus fpreportexporthtml > is zero. You forgot one thing: third-party libraries. E.g. your fpReport could use the "fprep" namespace. In the fpReport package you then define to use the fprep namespace - it means you can use units in fpReport without the "fprep" namespace - and without any collisions. In the main application you have the choice if you want to add the fprep namespace and can use fpReport units without the namespace or not. Collisions have to be resolved with the namespace anyway - but this is no really drawback. Furthermore code tools can handle dotted units (I added the support :) ) and namespaces will be handled as well once FPC supports them. So yes, namespaces are good :) - or at least they are no harm. It's your decision not to use them - they won't break anything. Ondrej -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc-gaertnma at netcologne.de Wed Sep 13 11:58:55 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 11:58:55 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913114023.225c2e8c@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> Message-ID: <20170913115855.279e185d@limapholos.matflo.wg> On Wed, 13 Sep 2017 11:40:23 +0200 Mattias Gaertner via Lazarus wrote: > On Wed, 13 Sep 2017 11:19:58 +0200 > Sven Barth via Lazarus wrote: > > >[...] > > The "." allows for a nicer disambiguation between what's the prefix and > > what's the remainder. Granted, that can be done with "_" as well, but in my > > personal opinion a "." simply looks nicer. :) > > I don't get why disambiguity is "nicer". The compiler has to > backstep and try all combinations to find out what a.b.c means. I meant ambiguity. ;) Mattias From michael at freepascal.org Wed Sep 13 12:03:05 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 12:03:05 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> Message-ID: On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: >> The benefit of writing fpreport.exporthtml versus fpreportexporthtml is >> zero. > > You forgot one thing: third-party libraries. E.g. your fpReport could use the > "fprep" namespace. In the fpReport package you then define to use the fprep > namespace - it means you can use units in fpReport without the "fprep" > namespace - and without any collisions. This is demonstrably not correct. It is *Only* correct if there are not 2 namespaces with the same unit in your project. See my example program, it demonstrates exactly that. Michael. From michael at freepascal.org Wed Sep 13 12:10:03 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 12:10:03 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <20170913115012.69bc7a89@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913111316.2d901692@limapholos.matflo.wg> <20170913115012.69bc7a89@limapholos.matflo.wg> Message-ID: On Wed, 13 Sep 2017, Mattias Gaertner wrote: > On Wed, 13 Sep 2017 11:28:55 +0200 (CEST) > Michael Van Canneyt wrote: > >> [...] >>>> The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. >>> >>> It's a little bit better than zero. For example shorter uses clause. >> >> Without using a switch to set namespaces ? Please Explain ? > > Namespaces without the switch are pretty useless. I thought you were > talking about namespaces as in Delphi. Sorry for the misunderstanding. They are one and the same. >> [...] >>> Did you add "uses utils"? >> >> Yes, obviously. Here is the test program: > > I see now that your point was the order of namespaces. Which is an > issue with unit paths as well. But with namespaces you can always pass > the whole unit name, while with unit paths you cannot. So I'm not sure > why the order is an argument against namespaces. Because, as I demonstrated, the order issue forces you to disambiguate the unit names anyway. Writing "uses utils;" is ambiguous if you are using 2 namespaces which both have a "utils" unit, and you use both of them somewhere in your project. We are agreed on that, I hope. So, to avoid this, you must write "uses web.utils" and "uses os.utils" (using my example). So, if you write a class library (using a namespace) with many units, you don't know in what environment it will be used, and what namespaces the end user will use on the command line (or maybe none). So, you must make sure all your code is unambiguous, i.e. write "namespace.unitname" everywhere. The same is true for the end-user. (see my demonstration program). So if you must disambiguate anyway (i.e. write web.utils). the whole point of using a namespace ("shorter names") becomes moot. I am not trying to dissuade anyone from using namespaces. I am trying to debunk a myth, namely that it will avoid unit name clashes. It does not, and in certain circumstances (using /NS switch) makes the problem only worse. The end point - what got all this started - is that whether you use fpreportutils.pp or fpreport.utils.pp is a matter of personal preference only. Using the latter does not avoid the possibility of name clashes. Michael. From lazarus at kluug.net Wed Sep 13 12:12:33 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 12:12:33 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> Message-ID: <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> On 13.09.2017 12:03, Michael Van Canneyt via Lazarus wrote: > > > On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: > >>> The benefit of writing fpreport.exporthtml versus fpreportexporthtml >>> is zero. >> >> You forgot one thing: third-party libraries. E.g. your fpReport could >> use the "fprep" namespace. In the fpReport package you then define to >> use the fprep namespace - it means you can use units in fpReport >> without the "fprep" namespace - and without any collisions. > > This is demonstrably not correct. > > It is *Only* correct if there are not 2 namespaces with the same unit in > your project. > > See my example program, it demonstrates exactly that. You didn't understand me. I was talking about a 3rd party library package and not about your/my project. Of course there can be collisions - if it happens you have to resolve them with explicit namespaces. Ondrej From michael at freepascal.org Wed Sep 13 12:28:22 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 12:28:22 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: > On 13.09.2017 12:03, Michael Van Canneyt via Lazarus wrote: >> >> >> On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: >> >>>> The benefit of writing fpreport.exporthtml versus fpreportexporthtml >>>> is zero. >>> >>> You forgot one thing: third-party libraries. E.g. your fpReport could >>> use the "fprep" namespace. In the fpReport package you then define to >>> use the fprep namespace - it means you can use units in fpReport >>> without the "fprep" namespace - and without any collisions. >> >> This is demonstrably not correct. >> >> It is *Only* correct if there are not 2 namespaces with the same unit in >> your project. >> >> See my example program, it demonstrates exactly that. > > You didn't understand me. I was talking about a 3rd party library > package and not about your/my project. Yes. And the same is true for this package. > > Of course there can be collisions - if it happens you have to resolve > them with explicit namespaces. Making the whole point moot. Michael. From zeljko at holobit.net Wed Sep 13 13:58:11 2017 From: zeljko at holobit.net (zeljko) Date: Wed, 13 Sep 2017 13:58:11 +0200 Subject: [Lazarus] LazReport - Issues 26971 and 30466 In-Reply-To: <8068ca6b-eb58-6df4-f13c-86e31709f3ef@bgss.hu> References: <8068ca6b-eb58-6df4-f13c-86e31709f3ef@bgss.hu> Message-ID: On 09/13/2017 10:51 AM, Gabor Boros via Lazarus wrote: > Hi All, > > https://bugs.freepascal.org/view.php?id=26971 > > ~3 years later. Any idea? No zeljko From pascaldragon at googlemail.com Wed Sep 13 14:38:55 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 13 Sep 2017 14:38:55 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913115855.279e185d@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> Message-ID: Am 13.09.2017 11:59 schrieb "Mattias Gaertner via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On Wed, 13 Sep 2017 11:40:23 +0200 > Mattias Gaertner via Lazarus wrote: > > > On Wed, 13 Sep 2017 11:19:58 +0200 > > Sven Barth via Lazarus wrote: > > > > >[...] > > > The "." allows for a nicer disambiguation between what's the prefix and > > > what's the remainder. Granted, that can be done with "_" as well, but in my > > > personal opinion a "." simply looks nicer. :) > > > > I don't get why disambiguity is "nicer". The compiler has to > > backstep and try all combinations to find out what a.b.c means. > > I meant ambiguity. ;) I'm not talking about ambiguity, I'm talking about aesthetics: FooBar.Blubb is easier to discern visually than FooBarBlubb. Also were is there an ambiguity anyway (given all units are used with their full name)? The compiler reads (in my above example) the token sequence ID Point ID and thus can find the unit without any backtracking just as for ordinary methods. Even once the default namespace option is added that won't change as the compiler will simply test all provided namespaces as prefixes and then the name as is. It's just a longer list of names than usually to test for. Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc-gaertnma at netcologne.de Wed Sep 13 15:33:35 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 15:33:35 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> Message-ID: <20170913153335.1e40b79b@limapholos.matflo.wg> On Wed, 13 Sep 2017 14:38:55 +0200 Sven Barth via Lazarus wrote: >[...] > I'm not talking about ambiguity, I'm talking about aesthetics: FooBar.Blubb > is easier to discern visually than FooBarBlubb. Well, aesthetics often goes together with "used to". I'm used to a point separates a sub identifier. The Delphi namespace concept breaks this rule. E.g. in a namespace "org.fpc" the dot is part of the identifier. Try "org.|" with the Delphi code insight. It does not show all possibilities. Lazarus code completion works better here. > Also were is there an ambiguity anyway (given all units are used with their > full name)? The compiler reads (in my above example) the token sequence ID > Point ID and thus can find the unit without any backtracking just as for > ordinary methods. Even once the default namespace option is added that > won't change as the compiler will simply test all provided namespaces as > prefixes and then the name as is. It's just a longer list of names than > usually to test for. Let's say you have 'a.b.c.d'. Before namespaces the compiler could simply resolve a, then b, then c and finally d. With namespaces the compiler has to read the full 'a.b.c.d', then search for a.b.c, then a.b, then a and then resolve the rest as before. For example: program unitdots.main1: uses unitdots.unit1, unitdots; type TPrgBright = unitdots.tbright; TPrgColor = unitdots.unit1.tcolor; TStrange = unitdots.main1.tprgcolor; var k1: longint; begin if unitdots.main1.k1=0 then ; if unitdots.j1=0 then ; if unitdots.unit1.i1=0 then ; Mattias From pascaldragon at googlemail.com Wed Sep 13 17:09:01 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 13 Sep 2017 17:09:01 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913153335.1e40b79b@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> Message-ID: Am 13.09.2017 15:33 schrieb "Mattias Gaertner via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On Wed, 13 Sep 2017 14:38:55 +0200 > Sven Barth via Lazarus wrote: > > >[...] > > I'm not talking about ambiguity, I'm talking about aesthetics: FooBar.Blubb > > is easier to discern visually than FooBarBlubb. > > Well, aesthetics often goes together with "used to". > I'm used to a point separates a sub identifier. > The Delphi namespace concept breaks this rule. E.g. in a namespace > "org.fpc" the dot is part of the identifier. Try "org.|" with the > Delphi code insight. It does not show all possibilities. Lazarus code > completion works better here. We all know that Delphi isn't the best example of an IDE out there :P > > Also were is there an ambiguity anyway (given all units are used with their > > full name)? The compiler reads (in my above example) the token sequence ID > > Point ID and thus can find the unit without any backtracking just as for > > ordinary methods. Even once the default namespace option is added that > > won't change as the compiler will simply test all provided namespaces as > > prefixes and then the name as is. It's just a longer list of names than > > usually to test for. > > Let's say you have 'a.b.c.d'. Before namespaces the compiler could > simply resolve a, then b, then c and finally d. > With namespaces the compiler has to read the full 'a.b.c.d', > then search for a.b.c, then a.b, then a and then resolve the rest as > before. Ah, using the identifier inside code. Okay I grant you that one regarding ambiguity... Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Wed Sep 13 17:09:15 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 16:09:15 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: <2c25027e-1298-6d1a-8433-d88ce0f1f0f5@geldenhuys.co.uk> On 2017-09-13 09:44, Michael Van Canneyt via Lazarus wrote: > As long as there are no command-line switch and directive for setting > namespaces, they are completely useless. Like I said, FPC still needs a bit more work before namespaces become more useful (or workable like Delphi intended). > And even with the command-line switch, the 'namespaces stop unit name > conflicts'argument is of course complete nonsense. It can greatly reduce conflicts. I would follow the Java namespace convention, and add a company name or organization as part of the namespace. So fpreportexporthtml.pp would become: fpc.fpreport.export.html.pp Granted that is a long unit name, but so is the original, and at least the dotted name reads much easier. Human minds don't read all lowercase or all uppercase combined words very easily - just look at MSEide's code. Only Martin likes that (and maybe you). ;-) Anyway, I would suggest all FPC units are prefixed with the "fpc." namespace. An example where namespaces do work well, is in tiOPF's "tiopf3" branch. The same unit names exist in VCL and FMX. Using namespaces as part of the target platform you want, it automatically helps resolve which unit you are referring to. So yes, we can show pros and cons to namespaces. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From nc-gaertnma at netcologne.de Wed Sep 13 17:11:27 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 17:11:27 +0200 Subject: [Lazarus] PasCon for Lazarus 2017 conference announcement Message-ID: <20170913171127.214aac2e@limapholos.matflo.wg> Hi all, The annual PasCon for Lazarus conference is this time on 14th Oct: http://www.blaisepascal.eu/agenda/lazarus_conference.php The conference is organized by Blaise Pascal Magazine and takes place in IJsselstein, Netherland. Mattias From michael at freepascal.org Wed Sep 13 17:35:57 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 17:35:57 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: <2c25027e-1298-6d1a-8433-d88ce0f1f0f5@geldenhuys.co.uk> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <2c25027e-1298-6d1a-8433-d88ce0f1f0f5@geldenhuys.co.uk> Message-ID: On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-13 09:44, Michael Van Canneyt via Lazarus wrote: >> As long as there are no command-line switch and directive for setting >> namespaces, they are completely useless. > > Like I said, FPC still needs a bit more work before namespaces become > more useful (or workable like Delphi intended). > > > > And even with the command-line switch, the 'namespaces stop unit name > > conflicts'argument is of course complete nonsense. > > It can greatly reduce conflicts. > > So fpreportexporthtml.pp would become: > > fpc.fpreport.export.html.pp Please take a good look at what you are writing. You are _seriously_ telling me that the chance of conflicts is "greatly reduced" when I use fpreport.export.html compared to when I use fpreportexporthtml ? Either the world or me has lost its marbles. I'm pretty sure it is not me. At last count, I still had them all. (But then that would be normal if I was going crazy :)) I will not argue about readability; that's a matter of taste: I much prefer FPReportExportHTML over fpreport_export_html or fpreport.export.html. Michael. From lazarus at kluug.net Wed Sep 13 18:09:40 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 18:09:40 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913153335.1e40b79b@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> Message-ID: <79836097-4853-0f19-5fe0-ab40543ff4f1@kluug.net> On 13.09.2017 15:33, Mattias Gaertner via Lazarus wrote: >> Also were is there an ambiguity anyway (given all units are used with their >> full name)? The compiler reads (in my above example) the token sequence ID >> Point ID and thus can find the unit without any backtracking just as for >> ordinary methods. Even once the default namespace option is added that >> won't change as the compiler will simply test all provided namespaces as >> prefixes and then the name as is. It's just a longer list of names than >> usually to test for. > Let's say you have 'a.b.c.d'. Before namespaces the compiler could > simply resolve a, then b, then c and finally d. > With namespaces the compiler has to read the full 'a.b.c.d', > then search for a.b.c, then a.b, then a and then resolve the rest as > before. I think you are wrong. I didn't study how the compiler resolves the identifiers internally, but when I developed dotted unit support for CodeTools I did it so: I register all namespaces and subnamespaces from known units (for uses clause) and used units (for implementation code) and resolve the identifiers from left to right - easy and how it's always been. In your example you always know if 'a' is a namespace or an identifier. The identifier always wins agains a namespace: unit ns1.Unit1; interface var   A: string;   ns1: Integer; implementation initialization   ns1.Unit1.A := 'a'; // << error illegal identifier end. unit ns1.Unit2; interface var   A: string;   ns1: Integer; implementation uses   ns1.Unit1; // error: duplicate identifier (bug in CodeTools: they don't show an error here because they don't test agains identifier in uses clause- but the compiler is correct) initialization   ns1 := 1; end. Everything looks like the compiler uses the same algorithm -> it first resolves a then b then c and so on, it doesn't need to go backwards. Ondrej From lazarus at kluug.net Wed Sep 13 18:23:38 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 18:23:38 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On 13.09.2017 12:28, Michael Van Canneyt wrote: > On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: >> On 13.09.2017 12:03, Michael Van Canneyt via Lazarus wrote: >>> On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: >>>>> The benefit of writing fpreport.exporthtml versus >>>>> fpreportexporthtml is zero. >>>> >>>> You forgot one thing: third-party libraries. E.g. your fpReport >>>> could use the "fprep" namespace. In the fpReport package you then >>>> define to use the fprep namespace - it means you can use units in >>>> fpReport without the "fprep" namespace - and without any collisions. >>> >>> This is demonstrably not correct. >>> >>> It is *Only* correct if there are not 2 namespaces with the same >>> unit in >>> your project. >>> >>> See my example program, it demonstrates exactly that. >> >> You didn't understand me. I was talking about a 3rd party library >> package and not about your/my project. > > Yes. And the same is true for this package. You can play this game forever... >> Of course there can be collisions - if it happens you have to resolve >> them with explicit namespaces. > > Making the whole point moot. You can understand namespaces and subnamespaces as a concept for folder structure within code. Of course you can have every single file in root D:\ and use endless CamelCase names: D:\MyCompanyAccounting201705Report1.xls D:\MyCompanyAccounting201705Report2.xls or you can have a decent folder structure: D:\MyCompany\Accounting\2017\05\Report1.xls D:\MyCompany\Accounting\2017\05\Report2.xls It's up to you. The -NSxyz is then similar to "use path" concept. If you see advantages in using folders you just have to admit there are also advantages when using namespaces. Ondrej From michael at freepascal.org Wed Sep 13 20:17:02 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 20:17:02 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On Wed, 13 Sep 2017, Ondrej Pokorny wrote: > >>> Of course there can be collisions - if it happens you have to resolve them >>> with explicit namespaces. >> >> Making the whole point moot. > > You can understand namespaces and subnamespaces as a concept for folder > structure within code. > > Of course you can have every single file in root D:\ and use endless > CamelCase names: > D:\MyCompanyAccounting201705Report1.xls > D:\MyCompanyAccounting201705Report2.xls > > or you can have a decent folder structure: > D:\MyCompany\Accounting\2017\05\Report1.xls > D:\MyCompany\Accounting\2017\05\Report2.xls > > It's up to you. > > The -NSxyz is then similar to "use path" concept. If you see advantages in > using folders you just have to admit there are also advantages when using > namespaces. The equivalent of uses utils; dcc32 /NSos /NSweb myprogram in your example is the same as saying "find me Report1.xls, search in D:\MyCompany\Accounting\2017\05 and D:\MyCompany\Accounting\2016\05" You will get an ambiguous answer. Which is the whole problem as I was trying to explain. That said, I use directory structure only to find files faster and group them logically. I would still name files in it uniquely. Using your example: D:\MyCompany\Accounting\2017\05\MCA-Report-201705-2.xls I will find the file quickly, and the name will still be unique. (within reasonable bounds) Similarly, every field in a database I create is always uniquely named. So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. Graeme Geldenhuys can testify that I use this practice even in very big databases. For the same reason: to avoid ambiguity. Michael. From mailinglists at geldenhuys.co.uk Wed Sep 13 20:19:12 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 19:19:12 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: On 2017-09-13 10:30, Michael Van Canneyt via Lazarus wrote: > When using CamelCase properly, you don't need _ or . at all. That would be my preference too. I love CamelCase - though personally I lowercase my unit names (files), but CamelCase the "unit xxx" line inside the unit. Now the next question - how well does FPC (compiler and all utilities included with FPC) handle camel case units on case sensitive file systems? Regards, Graeme From mailinglists at geldenhuys.co.uk Wed Sep 13 20:24:38 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 19:24:38 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913153335.1e40b79b@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> Message-ID: On 2017-09-13 14:33, Mattias Gaertner via Lazarus wrote: > Try "org.|" with the > Delphi code insight. Don't get me started on that again. The Delphi IDE is horribly horribly broken in comparison to Lazarus IDE. It two weeks of working with Delphi XE the other week I managed to find 13 bugs in the IDE alone - some known for years, others unknown. All were confirmed by other Delphi developers on the Internet. None were fixed in the latest Delphi Seattle (or whatever the hell the latest version is). Delphi is in a dark place. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From mailinglists at geldenhuys.co.uk Wed Sep 13 20:33:16 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 19:33:16 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On 2017-09-13 19:17, Michael Van Canneyt via Lazarus wrote: > Similarly, every field in a database I create is always uniquely named. > So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. > Graeme Geldenhuys can testify that I use this practice even in very big databases. I can confirm that. :) Regards, Graeme From mailinglists at geldenhuys.co.uk Wed Sep 13 20:34:58 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 13 Sep 2017 19:34:58 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> Message-ID: <31ba9f77-6ba4-ea0c-f38b-49d5ab4d4a30@geldenhuys.co.uk> On 2017-09-13 10:40, Ondrej Pokorny via Lazarus wrote: > Furthermore code tools can handle dotted units (I added the support:) ) > and namespaces will be handled as well once FPC supports them. Excellent!!! The development tools are waiting for the underlying compiler to catch up. Only in the open source world. :-D Regards, Graeme From vojtech.cihak at atlas.cz Wed Sep 13 20:42:21 2017 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Wed, 13 Sep 2017 20:42:21 +0200 Subject: [Lazarus] =?utf-8?q?FPReport_file_names?= In-Reply-To: 000000007c9f0000f5a00136505f References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru>, <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk>, , , 000000007c9f0000f5a00136505f Message-ID: <20170913204221.3B0C45B4@atlas.cz> Hi,   in fact, it is called PascalCase, see https://en.wikipedia.org/wiki/PascalCase   V. ______________________________________________________________ > Od: Graeme Geldenhuys via Lazarus > Komu: lazarus at lists.lazarus-ide.org > Datum: 13.09.2017 20:19 > Předmět: Re: [Lazarus] FPReport file names > On 2017-09-13 10:30, Michael Van Canneyt via Lazarus wrote: > When using CamelCase properly, you don't need _ or . at all. That would be my preference too. I love CamelCase - though personally I lowercase my unit names (files), but CamelCase the "unit xxx" line inside the unit. Now the next question - how well does FPC (compiler and all utilities included with FPC) handle camel case units on case sensitive file systems? Regards,   Graeme -- _______________________________________________ Lazarus mailing list Lazarus at lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc-gaertnma at netcologne.de Wed Sep 13 21:17:34 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 13 Sep 2017 21:17:34 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <79836097-4853-0f19-5fe0-ab40543ff4f1@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> <79836097-4853-0f19-5fe0-ab40543ff4f1@kluug.net> Message-ID: <20170913211734.34009b99@limapholos.matflo.wg> On Wed, 13 Sep 2017 18:09:40 +0200 Ondrej Pokorny via Lazarus wrote: >[...] > I think you are wrong. Partly. I just didn't tell the whole story. > I didn't study how the compiler resolves the > identifiers internally, but when I developed dotted unit support for > CodeTools I did it so: I register all namespaces and subnamespaces from > known units (for uses clause) and used units (for implementation code) > and resolve the identifiers from left to right - easy and how it's > always been. Yes, and I extended your code even further. > In your example you always know if 'a' is a namespace or an identifier. > The identifier always wins agains a namespace: > > unit ns1.Unit1; > interface > var >   A: string; >   ns1: Integer; > implementation > initialization >   ns1.Unit1.A := 'a'; // << error illegal identifier Correct. But if 'ns1' is part of a namespace, you have to search the namespace with the most dots. > end. > > unit ns1.Unit2; > interface > var >   A: string; >   ns1: Integer; > implementation > uses >   ns1.Unit1; // error: duplicate identifier (bug in CodeTools: they > don't show an error here because they don't test agains identifier in > uses clause- but the compiler is correct) Codetools is usually more tolerant than the compiler. > initialization >   ns1 := 1; > end. > > Everything looks like the compiler uses the same algorithm -> it first > resolves a then b then c and so on, it doesn't need to go backwards. It's not so simple. See my example for Sven: ... uses unitdots.unit1, unitdots; type TPrgBright = unitdots.tbright; TPrgColor = unitdots.unit1.tcolor; <-- ... Mattias From lazarus at kluug.net Wed Sep 13 21:57:50 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 21:57:50 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <20170913211734.34009b99@limapholos.matflo.wg> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> <79836097-4853-0f19-5fe0-ab40543ff4f1@kluug.net> <20170913211734.34009b99@limapholos.matflo.wg> Message-ID: <13cb89b9-410f-d214-c08c-69a50a6823c1@kluug.net> On 13.09.2017 21:17, Mattias Gaertner via Lazarus wrote: >> Everything looks like the compiler uses the same algorithm -> it first >> resolves a then b then c and so on, it doesn't need to go backwards. > It's not so simple. See my example for Sven: > ... > uses unitdots.unit1, unitdots; > type > TPrgBright = unitdots.tbright; > TPrgColor = unitdots.unit1.tcolor; <-- > ... I don't get it :) from left to right: is unitdots a namespace? -> yes -> is unit1 a subnamespace in unitdots? -> no -> is unit1 a file in unitdots namespace? -> yes -> find tcolor type in unitdots.unit1. Why do you need to read the identifier backwards? + Yes, I have a bug in CodeTools: program unitdots.main1; uses unitdots, unitdots.unit1; type   TPrgBright = unitdots.tbright;   TPrgColor = unitdots.unit1.tcolor;   TStrange = unitdots.main1.tprgcolor; var k1: longint; begin   if unitdots.main1=0 then ; // << compiler error (codetools jump to "main1: integer;" in unitdots.pas)   if unitdots.main1.k1=0 then ; // << OK (codetools don't find k1)   if unitdots.j1=0 then ;   if unitdots.unit1.i1=0 then ; end. unit unitdots; interface type   tbright = (yes, no); var   main1: integer;   unit1: integer;   j1: integer; implementation end. unit unitdots.unit1; interface type   tcolor = integer; var   i1: tcolor; implementation end. The namespace/unitname takes precedence before an identifier in an external unit. But it still looks to me like everything can be resolved from left to right - you just need to know the rules. CodeTools don't know this rule yet. But once they know it, they will resolve it correctly. Ondrej From lazarus at kluug.net Wed Sep 13 22:02:07 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 22:02:07 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On 13.09.2017 20:33, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-13 19:17, Michael Van Canneyt via Lazarus wrote: >> Similarly, every field in a database I create is always uniquely named. >> So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. >> Graeme Geldenhuys can testify that I use this practice even in very >> big databases. > > I can confirm that. :) Huh, that's hardcore :) Just curious: how do you define foreign keys? E.g. Customers.ID Invoices.CustomerID Orders.CustomerID etc? Ondrej From pascaldragon at googlemail.com Wed Sep 13 22:11:17 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 13 Sep 2017 22:11:17 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> Message-ID: On 13.09.2017 20:24, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-13 14:33, Mattias Gaertner via Lazarus wrote: >> Try "org.|" with the >> Delphi code insight. > > Don't get me started on that again. The Delphi IDE is horribly horribly > broken in comparison to Lazarus IDE. It two weeks of working with Delphi > XE the other week I managed to find 13 bugs in the IDE alone - some > known for years, others unknown. All were confirmed by other Delphi > developers on the Internet. None were fixed in the latest Delphi Seattle > (or whatever the hell the latest version is). Delphi is in a dark place. As if that was any news :P I use Delphi solely to test features I want to implement in FPC ;) Regards, Sven From pascaldragon at googlemail.com Wed Sep 13 22:18:06 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Wed, 13 Sep 2017 22:18:06 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> Message-ID: <152c93e6-8690-c0b3-d7fc-ed478d64df57@googlemail.com> On 13.09.2017 20:19, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-13 10:30, Michael Van Canneyt via Lazarus wrote: >> When using CamelCase properly, you don't need _ or . at all. > > That would be my preference too. I love CamelCase - though personally I > lowercase my unit names (files), but CamelCase the "unit xxx" line > inside the unit. Me, too :) > Now the next question - how well does FPC (compiler and all utilities > included with FPC) handle camel case units on case sensitive file systems? The compiler always searches units in this order: - as written in uses clause - all lowercase - all uppercase (and this whole block for extensions .pp, .pas and .p) This way on a case insensitive or case preserving (e.g. FAT, NTFS) file system the correct one is found on the first try and on case sensitive ones at least the way Lazarus by default stores units (lowercase files, unitname as-is) on the second try. Regards, Sven From michael at freepascal.org Wed Sep 13 22:23:54 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 13 Sep 2017 22:23:54 +0200 (CEST) Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: > On 13.09.2017 20:33, Graeme Geldenhuys via Lazarus wrote: >> On 2017-09-13 19:17, Michael Van Canneyt via Lazarus wrote: >>> Similarly, every field in a database I create is always uniquely named. >>> So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. >>> Graeme Geldenhuys can testify that I use this practice even in very >>> big databases. >> >> I can confirm that. :) > > Huh, that's hardcore :) > > Just curious: how do you define foreign keys? E.g. > Customers.ID > Invoices.CustomerID > Orders.CustomerID create table customer ( C_ID INT Primary key, C_FIRSTNAME VARCHAR(30), C_LASTNAME VARCHAR(50) ); CREATE table invoice ( I_ID INT PRIMARY KEY, I_CUSTOMER_FK INT, I_DATE DATE ); ALTER TABLE INVOICE ADD CONSTRAINT R_INVOICE_CUSTOMER FOREIGN KEY (I_CUSTOMER_FK) REFERENCES CUSTOMER(C_ID) ON CASCADE DELETE; 3 "rules" : Prefix is always somehow related to table name. Usually 1 or 2 letters. Occasionaly 3 (if you have close to 600 tables, 2 letters doesn't always cut it) Primary key is always Prefix_ID Foreign key is always Prefix_FOREIGNTABLE_FK The SQL you construct like this is always unambiguous, unless you use the same table twice in a single SQL select there is never any need to prefix the fields with the table name. Michael. From lazarus at kluug.net Wed Sep 13 22:32:48 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Wed, 13 Sep 2017 22:32:48 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> Message-ID: <65efdd49-bbca-7b4c-9a16-559ffe960fa5@kluug.net> On 13.09.2017 22:23, Michael Van Canneyt via Lazarus wrote: > create table customer ( >   C_ID INT Primary key, >   C_FIRSTNAME VARCHAR(30), >   C_LASTNAME VARCHAR(50) > ); > > CREATE table invoice ( >   I_ID INT PRIMARY KEY, >   I_CUSTOMER_FK INT, >   I_DATE DATE > ); > > ALTER TABLE INVOICE ADD CONSTRAINT R_INVOICE_CUSTOMER FOREIGN KEY > (I_CUSTOMER_FK) REFERENCES CUSTOMER(C_ID) ON CASCADE DELETE; > > 3 "rules" : > Prefix is always somehow related to table name. Usually 1 or 2 letters. > Occasionaly 3 (if you have close to 600 tables, 2 letters doesn't > always cut it) > > Primary key is always Prefix_ID > Foreign key is always Prefix_FOREIGNTABLE_FK > > The SQL you construct like this is always unambiguous, unless you use the > same table twice in a single SQL select there is never any need to prefix > the fields with the table name. Interesting approach. I do the opposite: I always (really always, even in simple statements) prefix the fields with the table name (and really the full table name, not an abbreviation/alias) :) With it I get unambiguity as well. And I really hate abbreviations since I fail to remember them. :) Everybody has their own taste - and it is good so. Otherwise we would all want to marry the same woman :) Ondrej From nc-gaertnma at netcologne.de Thu Sep 14 00:03:11 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Thu, 14 Sep 2017 00:03:11 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <152c93e6-8690-c0b3-d7fc-ed478d64df57@googlemail.com> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <152c93e6-8690-c0b3-d7fc-ed478d64df57@googlemail.com> Message-ID: <20170914000311.7f68555b@limapholos.matflo.wg> On Wed, 13 Sep 2017 22:18:06 +0200 Sven Barth via Lazarus wrote: >[...] > The compiler always searches units in this order: > - as written in uses clause > - all lowercase > - all uppercase > (and this whole block for extensions .pp, .pas and .p) Note that uppercase also uppercase the extension. I recommend to compile with -vt to see the details. > This way on a case insensitive or case preserving (e.g. FAT, NTFS) file > system the correct one is found on the first try and on case sensitive > ones at least the way Lazarus by default stores units (lowercase files, > unitname as-is) on the second try. Hint: Lazarus code completion uses the correct case for unit names even on Windows, which helps using mixed case. Mattias From nc-gaertnma at netcologne.de Thu Sep 14 00:43:34 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Thu, 14 Sep 2017 00:43:34 +0200 Subject: [Lazarus] FPReport file names In-Reply-To: <13cb89b9-410f-d214-c08c-69a50a6823c1@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <20170913114023.225c2e8c@limapholos.matflo.wg> <20170913115855.279e185d@limapholos.matflo.wg> <20170913153335.1e40b79b@limapholos.matflo.wg> <79836097-4853-0f19-5fe0-ab40543ff4f1@kluug.net> <20170913211734.34009b99@limapholos.matflo.wg> <13cb89b9-410f-d214-c08c-69a50a6823c1@kluug.net> Message-ID: <20170914004334.2df9abf4@limapholos.matflo.wg> On Wed, 13 Sep 2017 21:57:50 +0200 Ondrej Pokorny via Lazarus wrote: >[...] > > uses unitdots.unit1, unitdots; > > type > > TPrgBright = unitdots.tbright; > > TPrgColor = unitdots.unit1.tcolor; <-- > > ... > > I don't get it :) > from left to right: is unitdots a namespace? -> yes -> is unit1 a > subnamespace in unitdots? -> no -> is unit1 a file in unitdots > namespace? -> yes -> find tcolor type in unitdots.unit1. Why do you need > to read the identifier backwards? Sadly, there are no subnamespaces in Delphi. For example: uses unitdots.foo.bar, unitdots; t:=unitdots.foo.bla; // foo.bla is defined in unitdots According to your approach: Is unitdots a namespace -> yes -> is foo "subnamespace" -> yes -> find bla in "unitdots.foo" -> does not exist. > + Yes, I have a bug in CodeTools: > > program unitdots.main1; > uses unitdots, unitdots.unit1; > type >   TPrgBright = unitdots.tbright; >   TPrgColor = unitdots.unit1.tcolor; >   TStrange = unitdots.main1.tprgcolor; > var k1: longint; > begin >   if unitdots.main1=0 then ; // << compiler error (codetools jump to > "main1: integer;" in unitdots.pas) I fixed that some hours ago. The source name is a special case. >   if unitdots.main1.k1=0 then ; // << OK (codetools don't find k1) >   if unitdots.j1=0 then ; >   if unitdots.unit1.i1=0 then ; > end. > > unit unitdots; > interface > type >   tbright = (yes, no); > var >   main1: integer; >   unit1: integer; >   j1: integer; > implementation > end. > > unit unitdots.unit1; > interface > type >   tcolor = integer; > var >   i1: tcolor; > implementation > end. > > The namespace/unitname takes precedence before an identifier in an > external unit. Yes. > But it still looks to me like everything can be resolved > from left to right - you just need to know the rules. CodeTools don't > know this rule yet. But once they know it, they will resolve it correctly. To be honest, I have to lookup the rules from time to time. I wonder why Delphi did not come up with more intuitive rules. Mattias From tc at epidata.info Thu Sep 14 11:58:57 2017 From: tc at epidata.info (Torsten Bonde Christiansen) Date: Thu, 14 Sep 2017 11:58:57 +0200 Subject: [Lazarus] fpCEF3 questions Message-ID: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> Hi List. I am trying to work with the Chromium Embedded Framework from (https://github.com/dliw/fpCEF3) and (http://wiki.freepascal.org/fpCEF3) but parts of working with the framework is causing headaches... :) 1) I need to hook into the scrollbars such that i manually can position the view. 2) Parts of the focus handling seems to be either broken or my understanding of it is broken. 3) Using the TChromium component does not paint the view correctly when a main menu is used. There seems to be an offset problem. Kind regards Torsten. From noreply at z505.com Thu Sep 14 12:24:45 2017 From: noreply at z505.com (noreply at z505.com) Date: Thu, 14 Sep 2017 05:24:45 -0500 Subject: [Lazarus] Why is there no announcement of Lazarus event In-Reply-To: <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> References: <2c97cefb-06b3-0c1c-465b-da7d08aa92f1@geldenhuys.co.uk> <972CF592-B105-436C-A90E-10F1A42122A6@dommelstein.nl> Message-ID: On 2017-09-08 07:03, Marc Weustink via Lazarus wrote: > Which event are you referring to? > > Marc > The resurrection, second, or third coming of the hero Lazarus? Not fully familiar with the Bible character... but if Lazarus is here, I will need to see him. >> >> Just wondering? Or is it still coming? >> >> >> Regards, >> Graeme >> >> -- >> _______________________________________________ >> Lazarus mailing list >> Lazarus at lists.lazarus-ide.org >> https://lists.lazarus-ide.org/listinfo/lazarus > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From mailinglists at geldenhuys.co.uk Thu Sep 14 12:42:56 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Thu, 14 Sep 2017 11:42:56 +0100 Subject: [Lazarus] FPReport file names In-Reply-To: <65efdd49-bbca-7b4c-9a16-559ffe960fa5@kluug.net> References: <78f3c4ce-78c1-0660-3b8a-49806ea3425b@ya.ru> <6679741e-c692-4d17-fc57-cdbfc7f4d53c@geldenhuys.co.uk> <41c0991c-e46b-995f-ff15-05c810e3b9d0@kluug.net> <56310cd0-b32c-fdb7-6cfa-722e8b96fc4e@kluug.net> <65efdd49-bbca-7b4c-9a16-559ffe960fa5@kluug.net> Message-ID: <218ea73a-bc70-61f3-2838-0ec5f91ce3b4@geldenhuys.co.uk> On 2017-09-13 21:32, Ondrej Pokorny via Lazarus wrote: > And I really hate abbreviations since I fail to > remember them.:) That is indeed a problem, especially with 600+ tables. eg: What does prefix "I" or "IO" or "IN" mean, when you have 30+ tables starting with the letter "I". Personally I follow your approach kind of. The exception being that I use aliases for table names in big SQL queries, but I tend to use 4 character alias, because 1 character has the same problem as described above (but in a slightly smaller scale). > Everybody has their own taste - and it is good so. Otherwise we would > all want to marry the same woman:) Good one!!! :-D Regards, Graeme From dev.dliw at gmail.com Thu Sep 14 13:10:10 2017 From: dev.dliw at gmail.com (dev.dliw at gmail.com) Date: Thu, 14 Sep 2017 13:10:10 +0200 Subject: [Lazarus] fpCEF3 questions In-Reply-To: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> References: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> Message-ID: <11408999.VitxPhuprQ@desktop> Hi Torsten, >working with the framework is causing headaches being the author of fpCEF, I can confirm that ;) Is it correct, that you are using one of the latest versions of fpCEF on Linux? > 1) I need to hook into the scrollbars such that i manually can position > the view. There is no API for that, but you can write JavaScript to do the job. See the JavaScript example... > 2) Parts of the focus handling seems to be either broken or my > understanding of it is broken. If you are on Linux, this is a known problem (for me; I need create an issue on Github). I myself use fpCEF for showing html pages (no interaction), so I only realized it was broken, when doing the latest update. The problem seems to be within CEF: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on For GTK I think I found a way to work around the problem in fpCEF, but QT is totally broken. I'm trying to improve the current situation, but it will take some time. > 3) Using the TChromium component does not paint the view correctly when > a main menu is used. There seems to be an offset problem. Could you send a screenshot? On Linux there are many ways to break TChromium. The reason is the way how CEF is embedded into LCL. Currently CEF always is embedded directly into the XWindow of the Form and positioned / resized via X events. For simple use cases it usually works ok, but can break easily for more complex setups (like the tabbed browser). I already tried to embed CEF into the XWindow of the parent control of TChromium, but then event handling breaks for CEF and the client LCL application, if the parent is not a form. CEF at the moment also does not support Xembed, which IMO could solve many issues: https://bitbucket.org/chromiumembedded/cef/issues/1417/linux-improve-cef-x11-window-behavior-in The more robust solution on Linux ATM is the offscreen browser TChromiumOSR. Btw. I would be very happy if anyone could tell me, how to reliably embed a XWindow into any LCL widgetset on Linux. Kind regards, dliw From tc at epidata.info Thu Sep 14 13:50:19 2017 From: tc at epidata.info (Torsten Bonde Christiansen) Date: Thu, 14 Sep 2017 13:50:19 +0200 Subject: [Lazarus] fpCEF3 questions In-Reply-To: <11408999.VitxPhuprQ@desktop> References: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> <11408999.VitxPhuprQ@desktop> Message-ID: <7a4a147a-6286-bf11-2e9a-05a2e7c7971e@epidata.info> On 2017-09-14 13:10, dev.dliw at gmail.com wrote: > Hi Torsten, > >> working with the framework is causing headaches > being the author of fpCEF, I can confirm that ;) > > > Is it correct, that you are using one of the latest versions of fpCEF on > Linux? Absolutely correct. I'm using the currently available 3.3029 on Linux (64bit) GTK2 >> 1) I need to hook into the scrollbars such that i manually can position >> the view. > There is no API for that, but you can write JavaScript to do the job. > See the JavaScript example... Okay - thanks. >> 2) Parts of the focus handling seems to be either broken or my >> understanding of it is broken. > If you are on Linux, this is a known problem (for me; I need create an issue > on Github). > > I myself use fpCEF for showing html pages (no interaction), so I only realized > it was broken, when doing the latest update. > > The problem seems to be within CEF: > https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on > > For GTK I think I found a way to work around the problem in fpCEF, but QT is > totally broken. > I'm trying to improve the current situation, but it will take some time. In my project i create an HTML output for a statistical analysis program and the code itself is very simple - tables and paragraph, and only very little CSS. >> 3) Using the TChromium component does not paint the view correctly when >> a main menu is used. There seems to be an offset problem. > Could you send a screenshot? Without Main menu: With main menu: - notice the lacking tabs, this is more prominent if not using a pagecontrol, but any other wincontrol to host the browser. > On Linux there are many ways to break TChromium. The reason is the way how CEF > is embedded into LCL. Currently CEF always is embedded directly into the > XWindow of the Form and positioned / resized via X events. > For simple use cases it usually works ok, but can break easily for more > complex setups (like the tabbed browser). > I already tried to embed CEF into the XWindow of the parent control of > TChromium, but then event handling breaks for CEF and the client LCL > application, if the parent is not a form. > > CEF at the moment also does not support Xembed, which IMO could solve many > issues: > https://bitbucket.org/chromiumembedded/cef/issues/1417/linux-improve-cef-x11-window-behavior-in > > > The more robust solution on Linux ATM is the offscreen browser TChromiumOSR. In the OSR example the painting is tied to OpenGL IIRC, but can it be tied to something else? and how? Another issue with all the versions of CEF i have tried so far is that I get a SIGSEGV when closing any application that uses fpCEF. I have tried many combinations when trying to shutdown, but it seems to boil down to calling "CefCloseLibrary" that causes the SIGSEGV. Regards, Torsten. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: imiclgppjonjndfh.png Type: image/png Size: 26534 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fcofgbfkmbanhfio.png Type: image/png Size: 25125 bytes Desc: not available URL: From dev.dliw at gmail.com Thu Sep 14 15:05:34 2017 From: dev.dliw at gmail.com (dev.dliw at gmail.com) Date: Thu, 14 Sep 2017 15:05:34 +0200 Subject: [Lazarus] fpCEF3 questions In-Reply-To: <7a4a147a-6286-bf11-2e9a-05a2e7c7971e@epidata.info> References: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> <11408999.VitxPhuprQ@desktop> <7a4a147a-6286-bf11-2e9a-05a2e7c7971e@epidata.info> Message-ID: <9779836.fi69sH5IIX@desktop> > With main menu: > - notice the lacking tabs, this is more prominent if not using a > pagecontrol, but > any other wincontrol to host the browser. I see. The problem is, that the menu does not change the position of the controls on the form. E.g. if you out a button with Top=0 on an empty form and then add a menu, Top stays at 0. So the offset of TChromium is wrong. As a workaround you could change the position of the TChromium component (if on Linux). As I said, fpCEF on Linux embeds CEF into the XWindow of the main form, which is more or less a borderless window manually positioned over the LCL form. > In my project i create an HTML output for a statistical analysis program > and the code itself is very simple - tables and paragraph, and only very > little CSS. It doesn't really matter what you show via TChromium, but how you use TChromium. And the tabbed browser is probably the most complex case and unfortunately rather broken on Linux right now. However, if you really only want to show very simple HTML, then https://github.com/BerndGabriel/HtmlViewer may possibly be the better choice for you. > In the OSR example the painting is tied to OpenGL IIRC, but can it be > tied to something else? and how? Actually not. CEF only provides an array of pixel values, it is up to you to do whatever you want. Older versions of the OSRDemo used BGRABitmap: https://github.com/dliw/fpCEF3/blob/5335a5ba437d469eb6f933e47ae0e0cd3d6e8968/Examples/OSRDemo/main.pas#L113 > Another issue with all the versions of CEF i have tried so far is that I > get a SIGSEGV when closing any application that uses fpCEF. I have tried > many combinations when trying to shutdown, but it seems to boil down to > calling "CefCloseLibrary" that causes the SIGSEGV. See the last part of my answer in this issue: https://github.com/dliw/fpCEF3/issues/47#issuecomment-281333395 In the meantime I have a version which implements the correct CEF shutdown process. It works fine if there is only a single TChromium instance, but has side effects when used in the tabbed browser. Focus get lost for all other instances and there is no way to get it back, browser content turns black, etc. -> headaches... So no good nows - sorry. It very much depends on CEF to improve the usage on Linux. Regards, dliw From tc at epidata.info Thu Sep 14 15:30:38 2017 From: tc at epidata.info (Torsten Bonde Christiansen) Date: Thu, 14 Sep 2017 15:30:38 +0200 Subject: [Lazarus] fpCEF3 questions In-Reply-To: <9779836.fi69sH5IIX@desktop> References: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> <11408999.VitxPhuprQ@desktop> <7a4a147a-6286-bf11-2e9a-05a2e7c7971e@epidata.info> <9779836.fi69sH5IIX@desktop> Message-ID: <7426e61f-f41b-c699-6d02-bb65582dd0d7@epidata.info> On 2017-09-14 15:05, dev.dliw--- via Lazarus wrote: >> With main menu: >> - notice the lacking tabs, this is more prominent if not using a >> pagecontrol, but >> any other wincontrol to host the browser. > I see. > The problem is, that the menu does not change the position of the controls on > the form. > E.g. if you out a button with Top=0 on an empty form and then add a menu, Top > stays at 0. So the offset of TChromium is wrong. > > As a workaround you could change the position of the TChromium component (if > on Linux). > As I said, fpCEF on Linux embeds CEF into the XWindow of the main form, which > is more or less a borderless window manually positioned over the LCL form. I tried with applying the height of the TMenu, but the GTK implementation seems to have a generic value witch not truely corresponds to active DE and the style/font used... I guess I will have to live with it the way it is for now. > > >> In my project i create an HTML output for a statistical analysis program >> and the code itself is very simple - tables and paragraph, and only very >> little CSS. > It doesn't really matter what you show via TChromium, but how you use > TChromium. > And the tabbed browser is probably the most complex case and unfortunately > rather broken on Linux right now. > > However, if you really only want to show very simple HTML, then > https://github.com/BerndGabriel/HtmlViewer > may possibly be the better choice for you. The whole reason for using CEF was because the THhtmlViewer component is too slow! Especially in my case since I often work with many and large tables (100 / 1000+ rows) which causes significal slowdows in that component. > >> In the OSR example the painting is tied to OpenGL IIRC, but can it be >> tied to something else? and how? > Actually not. CEF only provides an array of pixel values, it is up to you to > do whatever you want. > Older versions of the OSRDemo used BGRABitmap: > https://github.com/dliw/fpCEF3/blob/5335a5ba437d469eb6f933e47ae0e0cd3d6e8968/Examples/OSRDemo/main.pas#L113 I will check that link out later and see if I can make the switch. > > >> Another issue with all the versions of CEF i have tried so far is that I >> get a SIGSEGV when closing any application that uses fpCEF. I have tried >> many combinations when trying to shutdown, but it seems to boil down to >> calling "CefCloseLibrary" that causes the SIGSEGV. > See the last part of my answer in this issue: > https://github.com/dliw/fpCEF3/issues/47#issuecomment-281333395 I have already made sure to sync both the fpCEF and the CEF-minimal i can download, but i still get the problem. For now i can make the call in a try .. except block and catch the error when closing down. That way the problem is only visible during debugging. :) > > In the meantime I have a version which implements the correct CEF shutdown > process. It works fine if there is only a single TChromium instance, but has > side effects when used in the tabbed browser. Focus get lost for all other > instances and there is no way to get it back, browser content turns black, > etc. > -> headaches... > > > So no good nows - sorry. It very much depends on CEF to improve the usage on > Linux. If my testing can help you in anyway just say so. I'm no hardcore GTK coder, but i have a little experience so I will try to see if I can assist you whenever possible. Kind regards Torsten. From dev.dliw at gmail.com Thu Sep 14 15:48:44 2017 From: dev.dliw at gmail.com (dev.dliw at gmail.com) Date: Thu, 14 Sep 2017 15:48:44 +0200 Subject: [Lazarus] fpCEF3 questions In-Reply-To: <7426e61f-f41b-c699-6d02-bb65582dd0d7@epidata.info> References: <46a8a4d4-51d9-90c9-81f2-c0af5c9f2c27@epidata.info> <9779836.fi69sH5IIX@desktop> <7426e61f-f41b-c699-6d02-bb65582dd0d7@epidata.info> Message-ID: <11073644.9tZiUgZEGl@desktop> > The whole reason for using CEF was because the THhtmlViewer component is > too slow! Well ok, bad advice then... > I will check that link out later and see if I can make the switch. Please note: When using OSR chromium one needs to handle all events and pass them to CEF "manually". OSRDemo at the moment only handles mouse events, so keyboard input does *not* work and needs to be implemented. > I have already made sure to sync both the fpCEF and the CEF-minimal i > can download, but i still get the problem. Sorry, I meant I have a version *locally*, but it creates more problems right now, than it solves. try .. except is the only "solution" now. >I will try to see if I can assist you whenever possible. Thanks for the offer. However, most of the problem really is on the CEF side and there is not much I can do to work around it. Even the official cefclient application has similar problems on Linux. https://bitbucket.org/chromiumembedded/cef/src/c95b92f1e8702ad4a74c4251d5d698f417a21717/tests/cefclient/?at=master Kind regards, dliw From jesusrmx at gmail.com Thu Sep 14 17:15:40 2017 From: jesusrmx at gmail.com (Jesus R.) Date: Thu, 14 Sep 2017 10:15:40 -0500 Subject: [Lazarus] LazReport - Issues 26971 and 30466 In-Reply-To: <8068ca6b-eb58-6df4-f13c-86e31709f3ef@bgss.hu> References: <8068ca6b-eb58-6df4-f13c-86e31709f3ef@bgss.hu> Message-ID: 2017-09-13 3:51 GMT-05:00 Gabor Boros via Lazarus : > https://bugs.freepascal.org/view.php?id=30466 > > The KeepChild feature is very important from my POV. Please review the > patch. (I have not tried yet.) It looks ok to me, I will commit it soon. Jesus Reyes A. From mlnglsts at bgss.hu Sun Sep 17 11:50:52 2017 From: mlnglsts at bgss.hu (Gabor Boros) Date: Sun, 17 Sep 2017 11:50:52 +0200 Subject: [Lazarus] LazReport - Where the width of the designer page come from? Message-ID: <3775ee8c-2c2e-e0c0-58e9-bdaa27898ee1@bgss.hu> Hi All, LazReport's designer page with in pixels is strange for me. LazReport - 752 FreeReport - 750 FastReport - 790 FPReport - 794 Width of A4 is 210mm. 210/25.4*96=793.7. Where the 752 come from? Gabor From mailinglists at geldenhuys.co.uk Mon Sep 18 00:05:18 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 17 Sep 2017 23:05:18 +0100 Subject: [Lazarus] LazReport - Where the width of the designer page come from? In-Reply-To: <3775ee8c-2c2e-e0c0-58e9-bdaa27898ee1@bgss.hu> References: <3775ee8c-2c2e-e0c0-58e9-bdaa27898ee1@bgss.hu> Message-ID: <438ded43-e7e0-24c0-f84b-738e01b67386@geldenhuys.co.uk> On 2017-09-17 10:50, Gabor Boros via Lazarus wrote: > Width of A4 is 210mm. 210/25.4*96=793.7. Yeah, fpReport is the only one with a sane value. :) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From jesusrmx at gmail.com Mon Sep 18 17:48:38 2017 From: jesusrmx at gmail.com (Jesus R.) Date: Mon, 18 Sep 2017 10:48:38 -0500 Subject: [Lazarus] LazReport - Where the width of the designer page come from? In-Reply-To: <438ded43-e7e0-24c0-f84b-738e01b67386@geldenhuys.co.uk> References: <3775ee8c-2c2e-e0c0-58e9-bdaa27898ee1@bgss.hu> <438ded43-e7e0-24c0-f84b-738e01b67386@geldenhuys.co.uk> Message-ID: LazReport does not use the standard or known paper size, it uses the printer reported values. For calculating the paper width it doesn't convert from mm, instead it uses the physical width of paper in dots at printer resolution then for the screen dimensions it scales down the value to a fixed resolution of 93 ppi and some account for aspect ratio which gives approximately 91 ppi, in other words LazReport scales the paper width to a fixed ppi, not to current screen ppi. The calculations are as follow (for my selected printer of resolution of 600 dpi). Paper width=4958 dots screen paper width = 4958/600*93/1.022=751.94 ~ 752 FreeReport should report the same and I cannot explain the differences other than probably it doesn't use the reported printer values but some standard ones. I don't know how the original creator of freereport came out to a value for aspect ratio of 1.022 in the X direction, I would be glad to know for sure though. 2017-09-17 17:05 GMT-05:00 Graeme Geldenhuys via Lazarus : > On 2017-09-17 10:50, Gabor Boros via Lazarus wrote: >> >> Width of A4 is 210mm. 210/25.4*96=793.7. > > > Yeah, fpReport is the only one with a sane value. :) > > Regards, > Graeme > > -- > fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal > http://fpgui.sourceforge.net/ > > My public PGP key: http://tinyurl.com/graeme-pgp > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From md at delfire.net Wed Sep 20 17:34:40 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 12:34:40 -0300 Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? Message-ID: Hi, Nowadays we have Unicode and so on. Is there any reason to these units (Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite) still exists? I've always used them, but days ago I needed to use XPath and the xpath unit works using objects from DOM unit, not laz2_DOM, and because that my doubt. Best regards, Marcos Douglas From michael at freepascal.org Wed Sep 20 17:36:14 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 20 Sep 2017 17:36:14 +0200 (CEST) Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > Hi, > > Nowadays we have Unicode and so on. > > Is there any reason to these units (Laz2_DOM, laz2_XMLRead, and > laz2_XMLWrite) still exists? > > I've always used them, but days ago I needed to use XPath and the > xpath unit works using objects from DOM unit, not laz2_DOM, and > because that my doubt. These units work using UTF8. The DOM units use UnicodeString (UTF16). Given that these units are quite stable in terms of functionality and maturity, it may be a good idea to move them to the FCL. Michael. From md at delfire.net Wed Sep 20 19:56:04 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 14:56:04 -0300 Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus wrote: > > These units work using UTF8. The DOM units use UnicodeString (UTF16). > > Given that these units are quite stable in terms of functionality and > maturity, it may be a good idea to move them to the FCL. Yes, that is my point. But instead of just moving them, shouldn't they merge as well into a single unit, ie, only one DOM, XMLRead, and XMLWrite unit? Best regards, Marcos Douglas From michael at freepascal.org Wed Sep 20 20:02:23 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 20 Sep 2017 20:02:23 +0200 (CEST) Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus > wrote: >> >> These units work using UTF8. The DOM units use UnicodeString (UTF16). >> >> Given that these units are quite stable in terms of functionality and >> maturity, it may be a good idea to move them to the FCL. > > Yes, that is my point. > But instead of just moving them, shouldn't they merge as well into a > single unit, ie, only one DOM, XMLRead, and XMLWrite unit? I don't think so, because how will you make the difference between the 2 ? And it's not possible to have optimal code for both cases in 1 set of classes; The idea is that there are no conversions necessary. Michael. From md at delfire.net Wed Sep 20 20:09:43 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 15:09:43 -0300 Subject: [Lazarus] Error loading a package with different versions Message-ID: I have a package with different versions like this: /mypack /1.0/src... /2.0/src... Then I have 2 project, each one using a different version. The same environment like this: http://wiki.freepascal.org/Lazarus_Packages#Example_library_with_multiple_lpk My problem is: Every time that I switch between these projects, I get an error from the IDE: "The following packages failed to load:" I'm using the menu: `Project->Open Recent Project` BUT, if I try again, ie, I click at the same menu item, choosing the same project that is already opened, the IDE refresh the package and load the right version. I believe something is wrong when the IDE try to close the loaded package for the first time, before open the right version. I'm using trunk, but an old revision: Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64 Best regards, Marcos Douglas From md at delfire.net Wed Sep 20 20:15:13 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 15:15:13 -0300 Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: On Wed, Sep 20, 2017 at 3:02 PM, Michael Van Canneyt via Lazarus wrote: > > > On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > >> On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus >> wrote: >>> >>> >>> These units work using UTF8. The DOM units use UnicodeString (UTF16). >>> >>> Given that these units are quite stable in terms of functionality and >>> maturity, it may be a good idea to move them to the FCL. >> >> >> Yes, that is my point. >> But instead of just moving them, shouldn't they merge as well into a >> single unit, ie, only one DOM, XMLRead, and XMLWrite unit? > > > I don't think so, because how will you make the difference between the 2 ? > And it's not possible to have optimal code for both cases in 1 set of > classes; The idea is that there are no conversions necessary. And we will continue having two base code to do the same thing? Don't you think this is confusing for the users? What about having just one code but setting the type of string (XMLString) to use? (even having Unicode... God) How can I use XPath with laz2_* units then? Regards, Marcos Douglas From michael at freepascal.org Wed Sep 20 20:38:23 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 20 Sep 2017 20:38:23 +0200 (CEST) Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > On Wed, Sep 20, 2017 at 3:02 PM, Michael Van Canneyt via Lazarus > wrote: >> >> >> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: >> >>> On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus >>> wrote: >>>> >>>> >>>> These units work using UTF8. The DOM units use UnicodeString (UTF16). >>>> >>>> Given that these units are quite stable in terms of functionality and >>>> maturity, it may be a good idea to move them to the FCL. >>> >>> >>> Yes, that is my point. >>> But instead of just moving them, shouldn't they merge as well into a >>> single unit, ie, only one DOM, XMLRead, and XMLWrite unit? >> >> >> I don't think so, because how will you make the difference between the 2 ? >> And it's not possible to have optimal code for both cases in 1 set of >> classes; The idea is that there are no conversions necessary. > > And we will continue having two base code to do the same thing? > Don't you think this is confusing for the users? > > What about having just one code but setting the type of string > (XMLString) to use? (even having Unicode... God) This is an option, but you'll still have 2 sets of units. > > How can I use XPath with laz2_* units then? Currently not, I think. All the more reason to move everything to FCL in a unified codebase. Or use your suggestion and use something like Type {$IFDEF XMLUTF8} XMLString = UTF8String; {$ELSE} XMLString = unicodestring; {$ENDIF} should do the job. I will have a look at this; the only thing that must then be properly checked is the actual reading and writing... Michael. From md at delfire.net Wed Sep 20 21:05:21 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 16:05:21 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= Message-ID: Hi, I'm working in my new "pet project" called Xavier. Xavier is an object-oriented library for work with XML. The motives and announcement is on the forum: http://forum.lazarus.freepascal.org/index.php/topic,38343.0.html Best regards, Marcos Douglas From nc-gaertnma at netcologne.de Wed Sep 20 21:19:49 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 20 Sep 2017 21:19:49 +0200 Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: References: Message-ID: <20170920211949.4dd7319b@limapholos.matflo.wg> On Wed, 20 Sep 2017 20:38:23 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: >[...] > Currently not, I think. > All the more reason to move everything to FCL in a unified codebase. +1 > Or use your suggestion and use something like > > Type > {$IFDEF XMLUTF8} > XMLString = UTF8String; > {$ELSE} > XMLString = unicodestring; > {$ENDIF} > > should do the job. I will have a look at this; the only thing that must > then be properly checked is the actual reading and writing... The laz2_dom has some options for keeping the spaces (indentation). Don't know if this was already backported to the original xmlreader/writer. Mattias From michael at freepascal.org Wed Sep 20 21:31:15 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 20 Sep 2017 21:31:15 +0200 (CEST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > Hi, > > I'm working in my new "pet project" called Xavier. > Xavier is an object-oriented library for work with XML. I don't understand the 'why' ? Should I understand that you consider the DOM units not object-oriented ? Michael. From nc-gaertnma at netcologne.de Wed Sep 20 21:53:03 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Wed, 20 Sep 2017 21:53:03 +0200 Subject: [Lazarus] Error loading a package with different versions In-Reply-To: References: Message-ID: <20170920215303.2d94342a@limapholos.matflo.wg> On Wed, 20 Sep 2017 15:09:43 -0300 "Marcos Douglas B. Santos via Lazarus" wrote: >[...] > I'm using trunk, but an old revision: > Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64 Please create a bug report. Mattias From md at delfire.net Wed Sep 20 22:09:08 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 17:09:08 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Wed, Sep 20, 2017 at 4:31 PM, Michael Van Canneyt via Lazarus wrote: > > > On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > >> Hi, >> >> I'm working in my new "pet project" called Xavier. >> Xavier is an object-oriented library for work with XML. > > > I don't understand the 'why' ? Should I understand that you consider the DOM > units not object-oriented ? Yes and no. Michael, with all my respect, that depends of your view about Object thinking. Yes, DOM uses classes and objects, but IMO Objects is more than that. Objects are more close to Functional programming than most people think. If can code classes but if you are implementing (all) in an imperative way, I mean line by line telling the computer how to do something instead of code what you just want, you may not are thinking in terms of Objects. Your class, in these cases, is just a "bucket of data and procedures". In a perfect design, we may only connect all objects to work in a "task", call "run", and "they" will know what to do. They (Objects) will decide how to do. Not the programmer (the "controller"). Just objects sending messages for each other. Yeah, looks so philosophical... :) I've been writing a blog about this for two years http://objectpascalprogramming.com/ ...and I use these same concepts in production code, of course. Best regards, Marcos Douglas From md at delfire.net Wed Sep 20 22:24:08 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 20 Sep 2017 17:24:08 -0300 Subject: [Lazarus] Error loading a package with different versions In-Reply-To: <20170920215303.2d94342a@limapholos.matflo.wg> References: <20170920215303.2d94342a@limapholos.matflo.wg> Message-ID: On Wed, Sep 20, 2017 at 4:53 PM, Mattias Gaertner via Lazarus wrote: > On Wed, 20 Sep 2017 15:09:43 -0300 > "Marcos Douglas B. Santos via Lazarus" > wrote: > >>[...] >> I'm using trunk, but an old revision: >> Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64 > > Please create a bug report. Done https://bugs.freepascal.org/view.php?id=32450 Marcos Douglas From michael at freepascal.org Thu Sep 21 00:33:41 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 21 Sep 2017 00:33:41 +0200 (CEST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > On Wed, Sep 20, 2017 at 4:31 PM, Michael Van Canneyt via Lazarus > wrote: >> >> >> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: >> >>> Hi, >>> >>> I'm working in my new "pet project" called Xavier. >>> Xavier is an object-oriented library for work with XML. >> >> >> I don't understand the 'why' ? Should I understand that you consider the DOM >> units not object-oriented ? > > Yes and no. > > Michael, with all my respect, that depends of your view about Object thinking. > Yes, DOM uses classes and objects, but IMO Objects is more than that. > Objects are more close to Functional programming than most people think. As I understand it, objects are exactly the opposite of functional programming, in that they encapsulate state, and functional programming wants to avoid state (variables, if you want). > If can code classes but if you are implementing (all) in an imperative > way, I mean line by line telling the computer how to do something > instead of code what you just want, you may not are thinking in terms > of Objects. Your class, in these cases, is just a "bucket of data and > procedures". Yes. That's what an object is. > > In a perfect design, we may only connect all objects to work in a > "task", call "run", and "they" will know what to do. Ah. You just replace methods by objects. You should be programming Java: https://steve-yegge.blogspot.be/2006/03/execution-in-kingdom-of-nouns.html I prefer imperative programming. (verbs, if you want). It comes more natural. Well, each his own style. But, if you allow me: the post on the lazarus forum and the Xavier page should really explain what you mean by OOP. I guess most people will be confused, as I am. Thanks for explaining. Michael. From md at delfire.net Thu Sep 21 05:06:52 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 21 Sep 2017 00:06:52 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Wed, Sep 20, 2017 at 7:33 PM, Michael Van Canneyt via Lazarus wrote: > > [...] > > You should be programming Java: > https://steve-yegge.blogspot.be/2006/03/execution-in-kingdom-of-nouns.html Nah... most of them know nothing about true OOP. They believe that an object is a "record" with getters and setters... anyway. > I prefer imperative programming. (verbs, if you want). It comes more > natural. > > Well, each his own style. But, if you allow me: the post on the lazarus > forum and the Xavier page should really explain what you mean by OOP. I > guess most people will be confused, as I am. As you said, each his own style. What is more important is keeping this excellent community united, around that great language called Object Pascal. And indeed is a good tip. I'll improve the README. Thank you. > > Thanks for explaining. You're welcome. Best regards, Marcos Douglas From leledumbo_cool at yahoo.co.id Thu Sep 21 07:57:34 2017 From: leledumbo_cool at yahoo.co.id (leledumbo) Date: Wed, 20 Sep 2017 22:57:34 -0700 (MST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: <1505973454924-0.post@n3.nabble.com> Free Pascal - Lazarus mailing list wrote > Hi, > > I'm working in my new "pet project" called Xavier. > Xavier is an object-oriented library for work with XML. > > The motives and announcement is on the forum: > http://forum.lazarus.freepascal.org/index.php/topic,38343.0.html Apart from not needing to free memory and simpler nodes retrieval, I can't really see any difference with DOM. I was expecting some kind of DSL to work with XML in a declarative way, but unfortunately it still looks imperative. -- Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/ From r030t1 at gmail.com Thu Sep 21 08:05:29 2017 From: r030t1 at gmail.com (R0b0t1) Date: Thu, 21 Sep 2017 01:05:29 -0500 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Wed, Sep 20, 2017 at 5:33 PM, Michael Van Canneyt via Lazarus wrote: > > > On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > >> On Wed, Sep 20, 2017 at 4:31 PM, Michael Van Canneyt via Lazarus >> wrote: >>> >>> >>> >>> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: >>> >>>> Hi, >>>> >>>> I'm working in my new "pet project" called Xavier. >>>> Xavier is an object-oriented library for work with XML. >>> >>> >>> >>> I don't understand the 'why' ? Should I understand that you consider the >>> DOM >>> units not object-oriented ? >> >> >> Yes and no. >> >> Michael, with all my respect, that depends of your view about Object >> thinking. >> Yes, DOM uses classes and objects, but IMO Objects is more than that. >> Objects are more close to Functional programming than most people think. > > > As I understand it, objects are exactly the opposite of functional > programming, > in that they encapsulate state, and functional programming wants to avoid > state (variables, if you want). > You can think of an object's data as a monad's data, and the methods in the objects in a hierarchy as the various monadic functions which operate on that data. In a typical functional language the monadic functions and their arguments do not have any hierarchical relation. >> If can code classes but if you are implementing (all) in an imperative >> way, I mean line by line telling the computer how to do something >> instead of code what you just want, you may not are thinking in terms >> of Objects. Your class, in these cases, is just a "bucket of data and >> procedures". > > > Yes. That's what an object is. > >> >> In a perfect design, we may only connect all objects to work in a >> "task", call "run", and "they" will know what to do. > > > Ah. You just replace methods by objects. > > You should be programming Java: > https://steve-yegge.blogspot.be/2006/03/execution-in-kingdom-of-nouns.html > > I prefer imperative programming. (verbs, if you want). It comes more > natural. > > Well, each his own style. But, if you allow me: the post on the lazarus > forum and the Xavier page should really explain what you mean by OOP. I > guess most people will be confused, as I am. > > Thanks for explaining. > > Michael. > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From mschnell at lumino.de Thu Sep 21 10:00:33 2017 From: mschnell at lumino.de (Michael Schnell) Date: Thu, 21 Sep 2017 10:00:33 +0200 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On 20.09.2017 22:09, Marcos Douglas B. Santos via Lazarus wrote: > In a perfect design, we may only connect all objects to work in a > "task", call "run", and "they" will know what to do. They (Objects) > will decide how to do. Not the programmer (the "controller"). Just > objects sending messages for each other. Is that what the (language construct) "Interface" is supposed to provide ? -Michael From sysrpl at gmail.com Thu Sep 21 12:32:14 2017 From: sysrpl at gmail.com (Anthony Walter) Date: Thu, 21 Sep 2017 06:32:14 -0400 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: Marcos, What and where are James.Data, James.Data.Clss? Have you seen my XML interface at this url? https://github.com/sysrpl/Cross.Codebot/blob/master/source/codebot.text.xml.pas It might be helpful to study and/or consider. Example: var D: IDocument; N: INode; F: IFiler; begin D := CreateDocument; N := D.Force('config/settings'); F := N.Filer; F.WriteStr('name', 'Marcos') F.WriteInt('@luckyNumber', 7); WriteLn(D.Text); D.Beautify; WriteLn(D.Text); end; Output: Marcos Marcos -------------- next part -------------- An HTML attachment was scrubbed... URL: From md at delfire.net Thu Sep 21 18:38:31 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 21 Sep 2017 13:38:31 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: <1505973454924-0.post@n3.nabble.com> References: <1505973454924-0.post@n3.nabble.com> Message-ID: On Thu, Sep 21, 2017 at 2:57 AM, leledumbo via Lazarus wrote: > Free Pascal - Lazarus mailing list wrote >> Hi, >> >> I'm working in my new "pet project" called Xavier. >> Xavier is an object-oriented library for work with XML. >> >> The motives and announcement is on the forum: >> http://forum.lazarus.freepascal.org/index.php/topic,38343.0.html > > Apart from not needing to free memory and simpler nodes retrieval, I can't > really see any difference with DOM. I was expecting some kind of DSL to work > with XML in a declarative way, but unfortunately it still looks imperative. I've just started this project and we don't have the 1.0 version yet. Any ideas could be considered at this point. Regards, Marcos Douglas From md at delfire.net Thu Sep 21 18:49:57 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 21 Sep 2017 13:49:57 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Thu, Sep 21, 2017 at 5:00 AM, Michael Schnell via Lazarus wrote: > On 20.09.2017 22:09, Marcos Douglas B. Santos via Lazarus wrote: >> >> In a perfect design, we may only connect all objects to work in a "task", >> call "run", and "they" will know what to do. They (Objects) will decide how >> to do. Not the programmer (the "controller"). Just objects sending messages >> for each other. > > Is that what the (language construct) "Interface" is supposed to provide ? No. But Interfaces are very important. There is not true OOP without "contracts" — that is what Interfaces are. You can use inheritance to provide polimorphism, but inheritance could be evil and should be avoided[1] as much you can. Instead, use composion. Others languages are using "duck typing", but I believe Interfaces are better. Regards, Marcos Douglas [1] My posts about inheritance https://goo.gl/nzM4Ss From md at delfire.net Thu Sep 21 20:24:14 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 21 Sep 2017 15:24:14 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Thu, Sep 21, 2017 at 7:32 AM, Anthony Walter via Lazarus wrote: > Marcos, > > What and where are James.Data, James.Data.Clss? Hi Anthony, Jame is another project of mine: https://github.com/mdbs99/james I've changed Xavier README a little bit including James as a dependency and some principles. Sorry about this misudestandy. > Have you seen my XML interface at this url? > > https://github.com/sysrpl/Cross.Codebot/blob/master/source/codebot.text.xml.pas > > It might be helpful to study and/or consider. Example: > > [...snip...] I know Codebot and Bare.Game for a long time. Maybe I already told you, but you're a great developer. You code things from the scratch and, even that, the design of your classes is clean and beautiful. I mean, you do not code like a "hacker", but as an architect. Your work have inspired me many times. Thank you. Unfortunately, I didn't remember about this part when I thought to code Xavier — but it was only a few hours coding with 2 beers. However, I have some principles or own style that prevents me to use Codebot. For example: I don't use functions anymore, only objects (tip: think about put your functions inside classes, see New() methods in Xavier); classes should be short as possible with 5 or less methods, most; no nil/NULL as a valid return; other things. But of course I will study (again) Codebot! For example, I will see how did you code XPath, because I need to know how to do this on Windows too. I can get many ideas from Codebot. Thanks again. What license did you use in Codebot? You might put a LICENSE file there... Another thing: You might divide Codebot in some specific libraries. I thought coding everything that I want in James, but I realized that is simpler to new users give just a piece that they want now, not a big library — even with dependencies. Best regards, Marcos Douglas From tc at epidata.info Fri Sep 22 08:10:58 2017 From: tc at epidata.info (Torsten Bonde Christiansen) Date: Fri, 22 Sep 2017 08:10:58 +0200 Subject: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite? In-Reply-To: <20170920211949.4dd7319b@limapholos.matflo.wg> References: <20170920211949.4dd7319b@limapholos.matflo.wg> Message-ID: On 2017-09-20 21:19, Mattias Gaertner via Lazarus wrote: > On Wed, 20 Sep 2017 20:38:23 +0200 (CEST) > Michael Van Canneyt via Lazarus wrote: > >> [...] >> Currently not, I think. >> All the more reason to move everything to FCL in a unified codebase. > +1 > >> Or use your suggestion and use something like >> >> Type >> {$IFDEF XMLUTF8} >> XMLString = UTF8String; >> {$ELSE} >> XMLString = unicodestring; >> {$ENDIF} >> >> should do the job. I will have a look at this; the only thing that must >> then be properly checked is the actual reading and writing... > The laz2_dom has some options for keeping the spaces > (indentation). Don't know if this was already backported to the > original xmlreader/writer. > > Mattias Please, please consider the fact that the FCL counterpart require (or at least used to) a widestring manager! This was not the case with Laz2_DOM, etc... and hence the sole reason why we a using these units and not the FCL ones! Just my 2 cents.... Kind regards, Torsten. From tc at epidata.info Fri Sep 22 09:42:26 2017 From: tc at epidata.info (Torsten Bonde Christiansen) Date: Fri, 22 Sep 2017 09:42:26 +0200 Subject: [Lazarus] TabControl stopped working from rev. 55890 Message-ID: <07607e1a-a374-9fb3-5b98-087f4e9f71ed@epidata.info> Hi List. Due to a change in wincontrol.inc regarding TabStop the TabControl has stopped working completely. It causes an A/V during create. Simple test: Start a new application, try placing a Tab Control (not Page Control - that one works) on the form => crash. Regards, Torsten. From m-w-vogel at gmx.de Fri Sep 22 09:46:01 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Fri, 22 Sep 2017 09:46:01 +0200 Subject: [Lazarus] TabControl stopped working from rev. 55890 In-Reply-To: <07607e1a-a374-9fb3-5b98-087f4e9f71ed@epidata.info> References: <07607e1a-a374-9fb3-5b98-087f4e9f71ed@epidata.info> Message-ID: Am 22.09.2017 um 09:42 schrieb Torsten Bonde Christiansen via Lazarus: > Due to a change in wincontrol.inc regarding TabStop the TabControl has > stopped working completely. It causes an A/V during create. Yes, I'll fix it. There is a old workaround, I'll see, if it is needed further. https://bugs.freepascal.org/view.php?id=32455 Michl From m-w-vogel at gmx.de Fri Sep 22 11:37:53 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Fri, 22 Sep 2017 11:37:53 +0200 Subject: [Lazarus] TabControl stopped working from rev. 55890 In-Reply-To: References: <07607e1a-a374-9fb3-5b98-087f4e9f71ed@epidata.info> Message-ID: <1588cf3b-02ad-6947-cc8d-cc5e9cec951f@gmx.de> Am 22.09.2017 um 09:46 schrieb Michael W. Vogel via Lazarus: > Am 22.09.2017 um 09:42 schrieb Torsten Bonde Christiansen via Lazarus: >> Due to a change in wincontrol.inc regarding TabStop the TabControl >> has stopped working completely. It causes an A/V during create. > > Yes, I'll fix it. There is a old workaround, I'll see, if it is needed > further. https://bugs.freepascal.org/view.php?id=32455 I fixed the issue in revision 55892 and removed the old workaround. Michl From el.es.cr at gmail.com Fri Sep 22 15:51:06 2017 From: el.es.cr at gmail.com (el es) Date: Fri, 22 Sep 2017 14:51:06 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On 21/09/17 17:49, Marcos Douglas B. Santos via Lazarus wrote: > > [1] My posts about inheritance https://goo.gl/nzM4Ss > If it only was in English ;) Unfortunately knowing Esperanto (once upon a time) only gets you so far.... as 5% ;) -L. From md at delfire.net Fri Sep 22 16:44:11 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Fri, 22 Sep 2017 11:44:11 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On Fri, Sep 22, 2017 at 10:51 AM, el es via Lazarus wrote: > On 21/09/17 17:49, Marcos Douglas B. Santos via Lazarus wrote: > >> >> [1] My posts about inheritance https://goo.gl/nzM4Ss >> > > If it only was in English ;) Unfortunately knowing Esperanto (once upon a time) > only gets you so far.... as 5% ;) The blog is written in Portuguese. Maybe I can be far from readers here, on this list. But remember that Brazil — Portuguese speakers — is a huge country and I have a consider audience. There are others countries that speak Portuguese too, as Portugal of course. However, the second largest audience in my blog, comes from English speakers. Third comes from Portugal. Believe or not. So, you can do like them: just use Google Translator. :) Regards, Marcos Douglas From pascaldragon at googlemail.com Sat Sep 23 00:40:24 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Sat, 23 Sep 2017 00:40:24 +0200 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: Am 22.09.2017 15:51 schrieb "el es via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On 21/09/17 17:49, Marcos Douglas B. Santos via Lazarus wrote: > > > > > [1] My posts about inheritance https://goo.gl/nzM4Ss > > > > If it only was in English ;) Unfortunately knowing Esperanto (once upon a time) > only gets you so far.... as 5% ;) Google Translate does a rather good job of translating the articles :) Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Sat Sep 23 10:25:46 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sat, 23 Sep 2017 09:25:46 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> On 2017-09-21 04:06, Marcos Douglas B. Santos via Lazarus wrote: > > Nah... most of them know nothing about true OOP. > They believe that an object is a "record" with getters and setters... anyway. If I understand you correctly... referring to Java developers, then that is a totally wrong generalisation. > As you said, each his own style. What is more important is keeping > this excellent community united, around that great language called > Object Pascal. I love Object Pascal too, and have a real soft spot for it (and always will). But G*D damn, Java is brilliant too. Not just Java the language, but the millions of frameworks and tools built around it too (JPA, Spring Boot, Jenkins, Maven etc). Also the understated Java Annotations are unbelievably powerful and can (and does) reduce the amount of boilerplate code tremendously(*). FPC doesn't even cover the most basic of things - no decent debugger that can handle all the Object Pascal language features. :-/ * Take a gander at how much Java Annotations reduced boiler plate code using JPA in EJB 3.0 and later vs EJB 2.1 which didn't use annotations. http://web.archive.org/web/20100731223045/http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From michael at freepascal.org Sat Sep 23 13:36:51 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 23 Sep 2017 13:36:51 +0200 (CEST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: On Sat, 23 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-21 04:06, Marcos Douglas B. Santos via Lazarus wrote: >> >> Nah... most of them know nothing about true OOP. >> They believe that an object is a "record" with getters and setters... > anyway. > > If I understand you correctly... referring to Java developers, then that > is a totally wrong generalisation. > > >> As you said, each his own style. What is more important is keeping >> this excellent community united, around that great language called >> Object Pascal. > > I love Object Pascal too, and have a real soft spot for it (and always > will). But G*D damn, Java is brilliant too. Not just Java the language, > but the millions of frameworks and tools built around it too (JPA, > Spring Boot, Jenkins, Maven etc). Also the understated Java Annotations > are unbelievably powerful and can (and does) reduce the amount of > boilerplate code tremendously(*). > > FPC doesn't even cover the most basic of things - no decent debugger > that can handle all the Object Pascal language features. :-/ Of course not. FPC is not a debugger, it is a compiler. But if you put the combined resources of IBM and Oracle at our disposal, we'll quickly catch up. > * Take a gander at how much Java Annotations reduced boiler plate code > using JPA in EJB 3.0 and later vs EJB 2.1 which didn't use > annotations. > > > http://web.archive.org/web/20100731223045/http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html That's actually a step backwards. Because it breaks the separation of object and storage. Good for some quick and dirty prototyping, but a potential disaster in the long run. It suffices that the DBA decides to move (part of) the data for storage, and you're dead... I have to manage an API where the same data can meanwhile come from 1 to 4 different kinds of databases, depending on some (for all practical purposes) random parameter. Luckily, at the start I separated storage and object. Michael. From mailinglists at geldenhuys.co.uk Sat Sep 23 18:30:01 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sat, 23 Sep 2017 17:30:01 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: On 2017-09-23 12:36, Michael Van Canneyt wrote: >> FPC doesn't even cover the most basic of things - no decent debugger >> that can handle all the Object Pascal language features. :-/ > > Of course not. FPC is not a debugger, it is a compiler. Strange then that FPC includes many other tools like documentation generators and such. But something as critical as a debugger has always been brushed under the carpet (low or no priority). A compiler and debugger go hand-in-hand as part of a developer's "toolbox" - think minimum requirements. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From michael at freepascal.org Sat Sep 23 22:11:59 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 23 Sep 2017 22:11:59 +0200 (CEST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: On Sat, 23 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-23 12:36, Michael Van Canneyt wrote: >>> FPC doesn't even cover the most basic of things - no decent debugger >>> that can handle all the Object Pascal language features. :-/ > > >> Of course not. FPC is not a debugger, it is a compiler. > > Strange then that FPC includes many other tools like documentation > generators and such. Touché :-) A good debugger is indeed sorely missed. Michael. From pascaldragon at googlemail.com Sun Sep 24 09:31:51 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Sun, 24 Sep 2017 09:31:51 +0200 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: Am 23.09.2017 18:30 schrieb "Graeme Geldenhuys via Lazarus" < lazarus at lists.lazarus-ide.org>: > > On 2017-09-23 12:36, Michael Van Canneyt wrote: >>> >>> FPC doesn't even cover the most basic of things - no decent debugger >>> that can handle all the Object Pascal language features. :-/ > > > >> >> Of course not. FPC is not a debugger, it is a compiler. > > > Strange then that FPC includes many other tools like documentation generators and such. But something as critical as a debugger has always been brushed under the carpet (low or no priority). A compiler and debugger go hand-in-hand as part of a developer's "toolbox" - think minimum requirements. Considering that both compilers and debuggers are considered part of the Holy Trinity of programming (with the third being operating systems) I personally am not surprised as writing any of those three is a hard task, much harder than e.g. a documentation generator and we definitely don't have the manpower for that. Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Sun Sep 24 09:55:04 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 24 Sep 2017 08:55:04 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: <5d9828f8-d042-b7f2-8c62-a34d1d3e659d@geldenhuys.co.uk> On 2017-09-24 08:31, Sven Barth via Lazarus wrote: > Holy Trinity of programming (with the third being operating systems) I > personally am not surprised as writing any of those three is a hard task, > much harder than e.g. a documentation generator and we definitely don't > have the manpower for that. Well, some of use have attempted that in the past - myself included. Good progress was made, but little time always being the enemy of open source, and nobody jumping in to help meant many of those debugger efforts has stopped. But that's the joys of open source - people only work on what they find interesting - if they have the time. :) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From mailinglists at geldenhuys.co.uk Sun Sep 24 10:02:24 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 24 Sep 2017 09:02:24 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: On 2017-09-23 12:36, Michael Van Canneyt wrote: > That's actually a step backwards. > Because it breaks the separation of object and storage. Of course I would normally agree with that, but if you look at the Java annotations in that article - they are not code per-se, but more like small code comments - enough to tell the JPA backend what to do. And Java's RTTI is chock full of information, so the JPA backend can extract exactly what it needs. eg: @Entity public class Person { ... } That's enough to notify the JPA that the Person class can be persisted to a "Person" table. They also work on the concept that defaults are used. You only add annotations if the defaults should not be used. This again minimise developer effort tremendously. > Good for some quick and dirty prototyping, but a potential disaster in the long run. No more effort that maintaining an external XML mapping file, or hard-coded CRUD visitor. > It suffices that the DBA decides to move (part of) the data for storage, and > you're dead... That would break all code I can think of, and would require developer effort to resolve no matter what. Sorry, this is getting a bit off-topic in this mailing list, so I'll stop here. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From mailinglists at geldenhuys.co.uk Sun Sep 24 10:10:28 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 24 Sep 2017 09:10:28 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: <90d4cdd2-74b1-86e7-8750-a9ef2bc7bfbe@geldenhuys.co.uk> On 2017-09-24 09:02, Graeme Geldenhuys via Lazarus wrote: > Of course I would normally agree with that, but if you look at the Java > annotations in that article Just curious, I know C# has annotations support too. Does Delphi? Regards, Graeme From michael at freepascal.org Sun Sep 24 10:13:53 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 24 Sep 2017 10:13:53 +0200 (CEST) Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: <90d4cdd2-74b1-86e7-8750-a9ef2bc7bfbe@geldenhuys.co.uk> References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> <90d4cdd2-74b1-86e7-8750-a9ef2bc7bfbe@geldenhuys.co.uk> Message-ID: On Sun, 24 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-24 09:02, Graeme Geldenhuys via Lazarus wrote: >> Of course I would normally agree with that, but if you look at the Java >> annotations in that article > > > Just curious, I know C# has annotations support too. Does Delphi? Yes. It's called Attributes. FPC has it too, but it is not yet in trunk. Michael. From juha.manninen62 at gmail.com Sun Sep 24 11:41:03 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sun, 24 Sep 2017 12:41:03 +0300 Subject: [Lazarus] Help for solving an ActiveX regression crash bug Message-ID: Regarding issue: https://bugs.freepascal.org/view.php?id=32375 Could somebody please provide a debugger backtrace and preferably a patch to fix it. Also finding out which revision caused the regression would be helpful. http://wiki.freepascal.org/How_do_I_create_a_bug_report#Regression_caused_by_a_certain_revision There are other similar issues which will likely be solved at the same go, like: https://bugs.freepascal.org/view.php?id=32030 My own development system has Linux and I will not configure a Windows system now. A long ToDo list already... Juha From md at delfire.net Sun Sep 24 15:00:45 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Sun, 24 Sep 2017 10:00:45 -0300 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> References: <0104a1d1-0469-5345-e014-e2d8355eecf8@geldenhuys.co.uk> Message-ID: On Sat, Sep 23, 2017 at 5:25 AM, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-21 04:06, Marcos Douglas B. Santos via Lazarus wrote: >> >> >> Nah... most of them know nothing about true OOP. >> They believe that an object is a "record" with getters and setters... >> anyway. > > > If I understand you correctly... referring to Java developers, then that is > a totally wrong generalisation. Ok, I will rephrase: most that I know, met, or that I read an article or comment on the internet. >> As you said, each his own style. What is more important is keeping >> this excellent community united, around that great language called >> Object Pascal. > > > I love Object Pascal too, and have a real soft spot for it (and always > will). But G*D damn, Java is brilliant too. Not just Java the language, but > the millions of frameworks and tools built around it too (JPA, Spring Boot, > Jenkins, Maven etc). Also the understated Java Annotations are unbelievably > powerful and can (and does) reduce the amount of boilerplate code > tremendously(*). > > FPC doesn't even cover the most basic of things - no decent debugger that > can handle all the Object Pascal language features. :-/ Unfortunately, I have to agree about the debugger. :( > * Take a gander at how much Java Annotations reduced boiler plate code > using JPA in EJB 3.0 and later vs EJB 2.1 which didn't use > annotations. > > > http://web.archive.org/web/20100731223045/http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html Thanks, Marcos Douglas From m-w-vogel at gmx.de Sun Sep 24 15:41:48 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Sun, 24 Sep 2017 15:41:48 +0200 Subject: [Lazarus] Help for solving an ActiveX regression crash bug In-Reply-To: References: Message-ID: Am 24.09.2017 um 11:41 schrieb Juha Manninen via Lazarus: > Regarding issue: > https://bugs.freepascal.org/view.php?id=32375 > > Could somebody please provide a debugger backtrace and preferably a > patch to fix it. > Also finding out which revision caused the regression would be helpful. > http://wiki.freepascal.org/How_do_I_create_a_bug_report#Regression_caused_by_a_certain_revision > > There are other similar issues which will likely be solved at the same go, like: > https://bugs.freepascal.org/view.php?id=32030 > > My own development system has Linux and I will not configure a Windows > system now. A long ToDo list already... I'll have a look at this issue and report. Michl From m-w-vogel at gmx.de Sun Sep 24 20:20:14 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Sun, 24 Sep 2017 20:20:14 +0200 Subject: [Lazarus] Help for solving an ActiveX regression crash bug In-Reply-To: References: Message-ID: Am 24.09.2017 um 15:41 schrieb Michael W. Vogel via Lazarus: > Am 24.09.2017 um 11:41 schrieb Juha Manninen via Lazarus: >> Regarding issue: >>   https://bugs.freepascal.org/view.php?id=32375 >> >> Could somebody please provide a debugger backtrace and preferably a >> patch to fix it. >> Also finding out which revision caused the regression would be helpful. >> http://wiki.freepascal.org/How_do_I_create_a_bug_report#Regression_caused_by_a_certain_revision >> >> There are other similar issues which will likely be solved at the >> same go, like: >>   https://bugs.freepascal.org/view.php?id=32030 >> >> My own development system has Linux and I will not configure a Windows >> system now. A long ToDo list already... > > I'll have a look at this issue and report. I added the relavant info on bugtracker. Michl From el.es.cr at gmail.com Mon Sep 25 10:22:51 2017 From: el.es.cr at gmail.com (el es) Date: Mon, 25 Sep 2017 09:22:51 +0100 Subject: [Lazarus] =?utf-8?q?=5BANN=5D_Xavier_for_XML_=E2=80=94_Compatible?= =?utf-8?q?_with_FPC_and_Delphi?= In-Reply-To: References: Message-ID: On 22/09/17 15:44, Marcos Douglas B. Santos via Lazarus wrote: > So, you can do like them: just use Google Translator. :) > > Regards, > Marcos Douglas > Am 22.09.2017 15:51 schrieb "el es via Lazarus" : > >Google Translate does a rather good job of translating the articles :) >Regards, >Sven I'll give it a try, thanks :) -L. From juha.manninen62 at gmail.com Mon Sep 25 11:07:25 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Mon, 25 Sep 2017 12:07:25 +0300 Subject: [Lazarus] Help for solving an ActiveX regression crash bug In-Reply-To: References: Message-ID: On Sun, Sep 24, 2017 at 9:20 PM, Michael W. Vogel via Lazarus wrote: > I added the relavant info on bugtracker. Thanks. You found the InterfacePropertyEditor and issue: https://bugs.freepascal.org/view.php?id=31324 as the culprit. There was a similar issue: https://bugs.freepascal.org/view.php?id=24570 which I tried to solve a long time ago but failed. It is now marked as resolved together with the other issue. I hope Mattias and/or Michal Gawrycki can look at the issue at some point. Juha From m-w-vogel at gmx.de Mon Sep 25 11:38:16 2017 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Mon, 25 Sep 2017 11:38:16 +0200 Subject: [Lazarus] Help for solving an ActiveX regression crash bug In-Reply-To: References: Message-ID: <793f22a1-90c1-0c18-05f5-82297260ef7a@gmx.de> Am 25.09.2017 um 11:07 schrieb Juha Manninen via Lazarus: > On Sun, Sep 24, 2017 at 9:20 PM, Michael W. Vogel via Lazarus > wrote: >> I added the relavant info on bugtracker. > Thanks. > You found the InterfacePropertyEditor and issue: > https://bugs.freepascal.org/view.php?id=31324 > as the culprit. > There was a similar issue: > https://bugs.freepascal.org/view.php?id=24570 > which I tried to solve a long time ago but failed. It is now marked as > resolved together with the other issue. > I hope Mattias and/or Michal Gawrycki can look at the issue at some point. The main problem is, if the Component = nil for TInterfacePropertyEditor.AllEqual the result was changed to true. Thatswhile there is a AV. But I don't know, why for Component := GetComponentReference there is the component nil?! Also (maybe the same reason) AV by freeing the component. Michl From md at delfire.net Mon Sep 25 20:02:43 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 15:02:43 -0300 Subject: [Lazarus] Converting all code to use UnicodeString Message-ID: Hi, Yes, yes... another email about Unicode, because it has not been completed yet. Sorry. I would like to know how I can develop CLI and GUI (Lazarus) programs using just UnicodeString, making them all compatible with Delphi compiler. My environment is: Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64 I thought that I could use this: {$mode delphi} {$modeswitch unicodestrings} Then, I made some tests: 1- Writing a CLI with basic chars: ===code-begin=== program Project1; {$mode delphi} {$modeswitch unicodestrings} uses SysUtils, Classes; const TXT = '1'#13#10'2'#13#10'3'; var Ss: TStrings; begin Ss := TStringList.Create; try Ss.Text := TXT; Writeln('text ', ss.Text); Writeln('count ', ss.Count); finally Ss.Free; end; ReadLn; end. ===code-end=== ===output-begin=== text 1 2 3 count 3 ===output-end=== Everything worked. No warnings. Good. Then I changed the const like this: ===code-begin=== const TXT: string = '1'#13#10'2'#13#10'3'; ===code-end=== Everything worked. But now I have a warning: project1.lpr(13,19) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" Why? Is not String supposed to be UnicodeString? Is TStrings ANSI and because that I got this warning? Then I changed the const like this: ===code-begin=== const TXT = '1'#13#10'2'#13#10'3'#13#10'áéíóú'; ===code-end=== And: ===output-begin=== text 1 2 3 áéíóú count 4 ===output-end=== Is it not possible to write accented chars to display at the console? 2- Writing a GUI with basic chars: I just copy the same code with some modifications: ===code-begin=== unit Unit1; {$mode delphi} {$modeswitch unicodestrings} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.lfm} const TXT = '1'#13#10'2'#13#10'3'#13#10; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var Ss: TStrings; begin Ss := TStringList.Create; try Ss.Text := TXT; ShowMessage('text ' + ss.Text); ShowMessage('count ' + ss.Count.ToString); finally Ss.Free; end; end; end. ===code-end=== Everything worked. But now I have a few warnings: Compile Project, Target: C:\temp\project1.exe: Success, Warnings: 4 unit1.pas(36,29) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" unit1.pas(36,34) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" unit1.pas(37,30) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" unit1.pas(37,45) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" Then, I changed the const like this (again): ===code-begin=== const TXT: string = '1'#13#10'2'#13#10'3'; ===code-end=== Everything worked. But now I have same warnings before. Then, I changed the const like this (yeah, again): ===code-begin=== const TXT = '1'#13#10'2'#13#10'3'#13#10'áéíóú'; ===code-end=== Everything worked. But now I have same warnings before. Finally ,I changed the const like this: ===code-begin=== const TXT: string = '1'#13#10'2'#13#10'3'#13#10'áéíóú'; ===code-end=== And now, the first message is: [Window Title] project1 [Content] text 1 2 3 áéíóú Summary: 1. I did simple programs with simple constants and I got different results or warnings. 2. I truly believe that smarter people as FPC team, Lazarus team, and all smart collaborators can code CLI, GUI and all compatible with Delphi... but for me is still very hard to understand. What I need and my thoughts for help you to help me: 1. I would like to use just "string" everywhere. 2. I DON'T care about performance like gain 2ms... 10ms... 1s... I really don't care, if I can code a simple and elegant code. 3. Don't think external files. If a have a UTF8 encoded file, I know that and I can use string conversion... but it is EXTERNAL, not part of the code. So, in my mind this is OK and normal. Again, my env is: Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64 May I code using just "string"? Thank you. Best regards, Marcos Douglas From lazarus at kluug.net Mon Sep 25 20:19:26 2017 From: lazarus at kluug.net (Ondrej Pokorny) Date: Mon, 25 Sep 2017 20:19:26 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On 25.09.2017 20:02, Marcos Douglas B. Santos via Lazarus wrote: > May I code using just "string"? Yes. LCL is ANSI/UTF8 only, so is TStrings. You can write Lazarus+Delphi compatible code without a lot of problems. Just use the string type. The only thing you have to be aware is that in Delphi you work with UTF-16 and in Lazarus with UTF-8 - but for most cases it doesn't really matter. You will have to write your own methods with IFDEF-ed code for things where it matters (read/write from/to buffer, char-by-char iterations etc.). Ondrej From md at delfire.net Mon Sep 25 20:32:32 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 15:32:32 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Mon, Sep 25, 2017 at 3:19 PM, Ondrej Pokorny via Lazarus wrote: > On 25.09.2017 20:02, Marcos Douglas B. Santos via Lazarus wrote: >> >> May I code using just "string"? > > > Yes. LCL is ANSI/UTF8 only, so is TStrings. > > You can write Lazarus+Delphi compatible code without a lot of problems. Just > use the string type. The only thing you have to be aware is that in Delphi > you work with UTF-16 and in Lazarus with UTF-8 - but for most cases it > doesn't really matter. You will have to write your own methods with IFDEF-ed > code for things where it matters (read/write from/to buffer, char-by-char > iterations etc.). But my code had different outputs and/or warnings only using Lazarus! You said compatible. What about Warnings? Why I need IFDEF-ed if the code "is" compatible? For example, is this code compatible/work with/on Delphi? https://github.com/mdbs99/james/blob/a9ad48fb8eaf4f11c6dd7b65d6ac2f63e6fc09fb/test/james.data.tests.pas#L57 Best regards, Marcos Douglas From md at delfire.net Mon Sep 25 20:51:25 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 15:51:25 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: I understand use IFDEF to compile in different platforms like Windows vs... err... Haiku. Of Linux vs Nintendo Wii... But why should I use IFDEF in a code that should be the same in both compilers (FPC vs Delphi)? Is it because the string type is not Unicode? OK, so I want to convert all to use UTF16, ie, UnicodeString (wrong name) and make ALL code compatible. But this is looks like not possible without: * IFDEFs * know a few {modes} * know what type of string I'm working on If there is an argument in the compiler to compile it with the definition of "all string is an UnicodeString like Java, C#, Delphi and all them", would be great. Then we will compile the compiler and Lazarus with the same type of string and everything will work. It will be slower than now? Yes, maybe... but we already use objects! If you want 500% performance, use pointers, records and procedures with whatever encode you want. But if you use objects, the overhead already exists... and who cares? 1ms... 2ms... even 2s that you may lost using UTF16? (or UTF8, but make all equal!) So? The world is using Ruby and they don't care... or Python, Java... and they store in UTF16 too, which requires a double of space... but if it works and the code is clean, should be more important, don't agree? Best regards, Marcos Douglas From pascaldragon at googlemail.com Mon Sep 25 21:43:04 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Mon, 25 Sep 2017 21:43:04 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> On 25.09.2017 20:51, Marcos Douglas B. Santos via Lazarus wrote: > I understand use IFDEF to compile in different platforms like Windows > vs... err... Haiku. Of Linux vs Nintendo Wii... > But why should I use IFDEF in a code that should be the same in both > compilers (FPC vs Delphi)? Because they *aren't* the same. In Delphi String = UnicodeString while in the RTL, the FCL and the LCL String = AnsiString(CP_ACP) and using a different modeswitch *does not* change that, cause modes are unit specific. > Is it because the string type is not Unicode? OK, so I want to convert > all to use UTF16, ie, UnicodeString (wrong name) and make ALL code > compatible. But this is looks like not possible without: > > * IFDEFs > * know a few {modes} > * know what type of string I'm working on > > > If there is an argument in the compiler to compile it with the > definition of "all string is an UnicodeString like Java, C#, Delphi > and all them", would be great. > Then we will compile the compiler and Lazarus with the same type of > string and everything will work. Especially the RTL is not ready for String = UnicodeString. So your best bet is to use UTF8String or set the default code page to UTF8 (the LCL units do that by default if I remember correctly, but Ondrej can confirm or deny that). > It will be slower than now? Yes, maybe... but we already use objects! > If you want 500% performance, use pointers, records and procedures > with whatever encode you want. But if you use objects, the overhead > already exists... and who cares? 1ms... 2ms... even 2s that you may > lost using UTF16? (or UTF8, but make all equal!) So? The world is > using Ruby and they don't care... or Python, Java... and they store in > UTF16 too, which requires a double of space... but if it works and the > code is clean, should be more important, don't agree? For FPC also more restricted targets are to be kept in mind (AVR, DOS, etc.). So the RTL will be adjusted in a way that it can be easily compiled with String = UnicodeString or as is now with String = AnsiString(CP_ACP). But we are not there yet. Regards, Sven From md at delfire.net Mon Sep 25 22:18:05 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 17:18:05 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> Message-ID: Hi Sven, First of all, thanks for your time to answer me. On Mon, Sep 25, 2017 at 4:43 PM, Sven Barth via Lazarus wrote: > On 25.09.2017 20:51, Marcos Douglas B. Santos via Lazarus wrote: >> I understand use IFDEF to compile in different platforms like Windows >> vs... err... Haiku. Of Linux vs Nintendo Wii... >> But why should I use IFDEF in a code that should be the same in both >> compilers (FPC vs Delphi)? > > Because they *aren't* the same. In Delphi String = UnicodeString while > in the RTL, the FCL and the LCL String = AnsiString(CP_ACP) and using a > different modeswitch *does not* change that, cause modes are unit specific. Yes, but using {$modeswitch unicodestrings}, at least in a certain unit, should work with the same code between compilers because "string", for that unit, is UnicodeString as Delphi string is, no? > Especially the RTL is not ready for String = UnicodeString. So your best > bet is to use UTF8String or set the default code page to UTF8 (the LCL > units do that by default if I remember correctly, but Ondrej can confirm > or deny that). Yes, Lazarus do that by default. But did you see in my examples, at the first email, how many inconsistencies I got, using just Lazarus and change chars in one simple constant? >> It will be slower than now? Yes, maybe... but we already use objects! >> If you want 500% performance, use pointers, records and procedures >> with whatever encode you want. But if you use objects, the overhead >> already exists... and who cares? 1ms... 2ms... even 2s that you may >> lost using UTF16? (or UTF8, but make all equal!) So? The world is >> using Ruby and they don't care... or Python, Java... and they store in >> UTF16 too, which requires a double of space... but if it works and the >> code is clean, should be more important, don't agree? > > For FPC also more restricted targets are to be kept in mind (AVR, DOS, > etc.). I know almost nothing about compilers. But IMHO, the compiler should have which it already have: "string", which is an alias. Then, for each OS, we should pass one argument like (simplifying): -S=UnicodeString or -S=AnsiString... something like that (I hope you understood). I mean, we should not have overload functions, but only one type of string. Even if that type may be RawByteString. After compiled, we will have a RTL that will work follow the "-S" argument. > So the RTL will be adjusted in a way that it can be easily > compiled with String = UnicodeString or as is now with String = > AnsiString(CP_ACP). But we are not there yet. Now we're talking. Almost everyone that know how to work with "the group of strings", making them compatible between FPC and Delphi, are saying that Unicode is already done and everything is fine. You are the first one to say that is not complete yet. Thank you. I'm glad to know that I'm not crazy. Best regards, Marcos Douglas From nc-gaertnma at netcologne.de Mon Sep 25 22:45:03 2017 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Mon, 25 Sep 2017 22:45:03 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> Message-ID: <20170925224503.7d95cddf@limapholos.matflo.wg> On Mon, 25 Sep 2017 17:18:05 -0300 "Marcos Douglas B. Santos via Lazarus" wrote: >[...] > Yes, but using {$modeswitch unicodestrings}, at least in a certain > unit, should work with the same code between compilers because > "string", for that unit, is UnicodeString as Delphi string is, no? The important thing is "in a certain unit". As soon as you access strings from other units, you have to consider their type. > > Especially the RTL is not ready for String = UnicodeString. So your best > > bet is to use UTF8String or set the default code page to UTF8 (the LCL > > units do that by default if I remember correctly, but Ondrej can confirm > > or deny that). Unit LazUtf8 does it. > Yes, Lazarus do that by default. But did you see in my examples, at > the first email, how many inconsistencies I got, using just Lazarus > and change chars in one simple constant? Your first email does not contain a simple Lazarus+string example. I see an example for LCL+unicodestring. >[...] > I know almost nothing about compilers. But IMHO, the compiler should > have which it already have: "string", which is an alias. > Then, for each OS, we should pass one argument like (simplifying): > -S=UnicodeString or -S=AnsiString... something like that (I hope you > understood). The flags are -MDelphiUnicode, -MDelphi or -MObjFPC. But they only compile the units with sources in the unit path, which excludes all FPC units. Also keep in mind that the system unit and the RTL require a lot of low level functions, which require separate versions. > I mean, we should not have overload functions, but only one type of > string. Even if that type may be RawByteString. From a user pov: Yes, that's what Lazarus is recommending: Simply use one string type, and that is String. The confusion starts when you start using different string types. > After compiled, we will have a RTL that will work follow the "-S" argument. The RTL has already a lot of IFDEFs for the coming UnicodeString RTL. > > So the RTL will be adjusted in a way that it can be easily > > compiled with String = UnicodeString or as is now with String = > > AnsiString(CP_ACP). But we are not there yet. > > Now we're talking. > Almost everyone that know how to work with "the group of strings", > making them compatible between FPC and Delphi, are saying that Unicode > is already done and everything is fine. You are the first one to say > that is not complete yet. Thank you. I'm glad to know that I'm not > crazy. Unicode <> UnicodeString Unicode is working with UTF-8. If you want a Delphi compatible UTF-16 RTL and packages you are welcome to help the FPC team. Mattias From pascaldragon at googlemail.com Mon Sep 25 23:10:04 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Mon, 25 Sep 2017 23:10:04 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> Message-ID: On 25.09.2017 22:18, Marcos Douglas B. Santos via Lazarus wrote: > Hi Sven, > First of all, thanks for your time to answer me. > > On Mon, Sep 25, 2017 at 4:43 PM, Sven Barth via Lazarus > wrote: >> On 25.09.2017 20:51, Marcos Douglas B. Santos via Lazarus wrote: >>> I understand use IFDEF to compile in different platforms like Windows >>> vs... err... Haiku. Of Linux vs Nintendo Wii... >>> But why should I use IFDEF in a code that should be the same in both >>> compilers (FPC vs Delphi)? >> >> Because they *aren't* the same. In Delphi String = UnicodeString while >> in the RTL, the FCL and the LCL String = AnsiString(CP_ACP) and using a >> different modeswitch *does not* change that, cause modes are unit specific. > > Yes, but using {$modeswitch unicodestrings}, at least in a certain > unit, should work with the same code between compilers because > "string", for that unit, is UnicodeString as Delphi string is, no? Yes, but it does not change the types of functions, classes, etc. that are used. They have the types they were compiled with while you are using a different string type. So you can't simply override a virtual method for example that has a String argument that is in fact a AnsiString with a method that has a String that's a UnicodeString as argument. So of course there will be warnings in case you're passing UnicodeString variables to AnsiString variables. >> Especially the RTL is not ready for String = UnicodeString. So your best >> bet is to use UTF8String or set the default code page to UTF8 (the LCL >> units do that by default if I remember correctly, but Ondrej can confirm >> or deny that). > > Yes, Lazarus do that by default. But did you see in my examples, at > the first email, how many inconsistencies I got, using just Lazarus > and change chars in one simple constant? Note: I'll ignore the GUI example, cause Ondrej might be better for that. For the console you need to keep in mind that the console - at least on Windows - has a code page as well. On my Linux - which is set to UTF-8 - your example works without any problem, but if I use Wine I get the same output as you. >>> It will be slower than now? Yes, maybe... but we already use objects! >>> If you want 500% performance, use pointers, records and procedures >>> with whatever encode you want. But if you use objects, the overhead >>> already exists... and who cares? 1ms... 2ms... even 2s that you may >>> lost using UTF16? (or UTF8, but make all equal!) So? The world is >>> using Ruby and they don't care... or Python, Java... and they store in >>> UTF16 too, which requires a double of space... but if it works and the >>> code is clean, should be more important, don't agree? >> >> For FPC also more restricted targets are to be kept in mind (AVR, DOS, >> etc.). > > I know almost nothing about compilers. But IMHO, the compiler should > have which it already have: "string", which is an alias. > Then, for each OS, we should pass one argument like (simplifying): > -S=UnicodeString or -S=AnsiString... something like that (I hope you > understood). The compiler is not the problem. It's that especially the low level part of the RTL needs to be aware of the String type and handle it correctly. Essentially all functions will need to be checked whether they can correctly handle String (as in the generic string type) or are specific for AnsiString and thus would need to be adjusted. > I mean, we should not have overload functions, but only one type of > string. Even if that type may be RawByteString. You are wrong. Think about functions reading or writing data from/to files. Especially when the data was written with the other String type in mind. > > After compiled, we will have a RTL that will work follow the "-S" argument. > >> So the RTL will be adjusted in a way that it can be easily >> compiled with String = UnicodeString or as is now with String = >> AnsiString(CP_ACP). But we are not there yet. > > Now we're talking. > Almost everyone that know how to work with "the group of strings", > making them compatible between FPC and Delphi, are saying that Unicode > is already done and everything is fine. You are the first one to say > that is not complete yet. Thank you. I'm glad to know that I'm not > crazy. Unicode itself is working, but in the form of UTF-8, not UTF-16 and as such it is as compatible to Delphi as it can currently get with some caveats when the specific type is important. Regards, Sven From md at delfire.net Mon Sep 25 23:11:22 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 18:11:22 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: <20170925224503.7d95cddf@limapholos.matflo.wg> References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: Hi Mattias, On Mon, Sep 25, 2017 at 5:45 PM, Mattias Gaertner via Lazarus wrote: > On Mon, 25 Sep 2017 17:18:05 -0300 > "Marcos Douglas B. Santos via Lazarus" > wrote: > >>[...] > > Your first email does not contain a simple Lazarus+string example. I > see an example for LCL+unicodestring. Yes, because I tried to make the code compatible. If Delphi uses UTF16 there is some logic to use it the same encode... I thought. >>[...] >> I know almost nothing about compilers. But IMHO, the compiler should >> have which it already have: "string", which is an alias. >> Then, for each OS, we should pass one argument like (simplifying): >> -S=UnicodeString or -S=AnsiString... something like that (I hope you >> understood). > > The flags are -MDelphiUnicode, -MDelphi or -MObjFPC. > But they only compile the units with sources in the unit path, which > excludes all FPC units. Also keep in mind that the system unit and the > RTL require a lot of low level functions, which require separate > versions. Which make this flags useless for that. It should be all code (my, RTL, Lazarus, etc) to make this work using one type of string. >> I mean, we should not have overload functions, but only one type of >> string. Even if that type may be RawByteString. > > From a user pov: Yes, that's what Lazarus is recommending: Simply use > one string type, and that is String. The confusion starts when you start > using different string types. Yeah, but DOM uses DOMString, which is WideString. Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is UTF8, but I cannot use this unit with XPath unit, which needs a TXMLDocument that works with WideString... see my point? RTL was only ANSI, now has overload to UnicodeString... but according with Sven, the Unicode support is not finished yet. And what about the huge Warnings between these units, do you think that is normal to use cast on everything? > Unicode <> UnicodeString > Unicode is working with UTF-8. > If you want a Delphi compatible UTF-16 RTL and packages you are welcome > to help the FPC team. I can help in a high level way (Classes, Components, etc) not in the compiler level. But how can I know about these tasks? May I just pick one in bug tracker that I want? How to know who is working on each task, which is more important? Best regards, Marcos Douglas From pascaldragon at googlemail.com Mon Sep 25 23:23:01 2017 From: pascaldragon at googlemail.com (Sven Barth) Date: Mon, 25 Sep 2017 23:23:01 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: <52b7765f-d57f-7c2b-f170-e57ec0499079@googlemail.com> On 25.09.2017 23:11, Marcos Douglas B. Santos via Lazarus wrote: >>> [...] >>> I know almost nothing about compilers. But IMHO, the compiler should >>> have which it already have: "string", which is an alias. >>> Then, for each OS, we should pass one argument like (simplifying): >>> -S=UnicodeString or -S=AnsiString... something like that (I hope you >>> understood). >> >> The flags are -MDelphiUnicode, -MDelphi or -MObjFPC. >> But they only compile the units with sources in the unit path, which >> excludes all FPC units. Also keep in mind that the system unit and the >> RTL require a lot of low level functions, which require separate >> versions. > > Which make this flags useless for that. It should be all code (my, > RTL, Lazarus, etc) to make this work using one type of string. No, because especially the RTL and FCL is usually provided precompiled. Thus you can't change the string type anymore afterwards without recompiling all the code. >> Unicode <> UnicodeString >> Unicode is working with UTF-8. >> If you want a Delphi compatible UTF-16 RTL and packages you are welcome >> to help the FPC team. > > I can help in a high level way (Classes, Components, etc) not in the > compiler level. > But how can I know about these tasks? May I just pick one in bug > tracker that I want? How to know who is working on each task, which is > more important? Currently noone is working on it. A first step would be to add modeswitch headers to all units that must not use a specific mode (e.g. the System, ObjPas and some more language support units) like this: === code begin === {$ifdef FPC_UNICODE_RTL} {$modeswitch unicodestrings} {$endif} === code end === Once this is done one can test to compile the RTL, FCL and packages with FPC_UNICODE_RTL defined and see what blows and fix that step by step... Alternatively a constant in the System unit might be better so that one can check like this: === code begin === // System unit {$ifdef FPC_UNICODE_RTL} FpcRtlIsUnicode = true; {$else} FpcRtlIsUnicode = false; {$endif} // some other unit {$if FpcRtlIsUnicode} {$modeswitch unicodestrings} {$endif} === code end === Or if one wants to compile with -Municodestrings than instead the core units need to be protected with === code begin === {$modeswitch unicodestrings-} === code end === I'm currently not sure what would be the better approach in the long term... :/ Regards, Sven From md at delfire.net Mon Sep 25 23:35:02 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 18:35:02 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> Message-ID: On Mon, Sep 25, 2017 at 6:10 PM, Sven Barth via Lazarus wrote: > On 25.09.2017 22:18, Marcos Douglas B. Santos via Lazarus wrote: >> [...] >> Yes, but using {$modeswitch unicodestrings}, at least in a certain >> unit, should work with the same code between compilers because >> "string", for that unit, is UnicodeString as Delphi string is, no? > > Yes, but it does not change the types of functions, classes, etc. that > are used. They have the types they were compiled with while you are > using a different string type. So you can't simply override a virtual > method for example that has a String argument that is in fact a > AnsiString with a method that has a String that's a UnicodeString as > argument. So of course there will be warnings in case you're passing > UnicodeString variables to AnsiString variables. I saw that many RTL functions have an overload like this: Function FileExists (Const FileName : RawByteString) : Boolean; Function FileExists (Const FileName : UnicodeString) : Boolean; The first one calls the second: Function FileExists (Const FileName : RawByteString) : Boolean; begin Result:=FileExists(UnicodeString(FileName)); end; My question is: No matter the encode of FileName: RawByteString is, if I cast to UnicodeString I will not have any loss of characters? >> Yes, Lazarus do that by default. But did you see in my examples, at >> the first email, how many inconsistencies I got, using just Lazarus >> and change chars in one simple constant? > > Note: I'll ignore the GUI example, cause Ondrej might be better for that. No problem. > For the console you need to keep in mind that the console - at least on > Windows - has a code page as well. On my Linux - which is set to UTF-8 - > your example works without any problem, but if I use Wine I get the same > output as you. Ok, but the compiler knows if a program is a CLI, I believe... so, it could change those variables DefaultSystemCodePage, DefaultFileSystemCodePage... For users (developers) is not clear, do you agree? >>[...] >> I know almost nothing about compilers. But IMHO, the compiler should >> have which it already have: "string", which is an alias. >> Then, for each OS, we should pass one argument like (simplifying): >> -S=UnicodeString or -S=AnsiString... something like that (I hope you >> understood). > > The compiler is not the problem. It's that especially the low level part > of the RTL needs to be aware of the String type and handle it correctly. > Essentially all functions will need to be checked whether they can > correctly handle String (as in the generic string type) or are specific > for AnsiString and thus would need to be adjusted. I see... >> I mean, we should not have overload functions, but only one type of >> string. Even if that type may be RawByteString. > > You are wrong. Think about functions reading or writing data from/to > files. Especially when the data was written with the other String type > in mind. It is normal that external data (files) to have different encodes. IMO, only in these cases, we should care about encoding, because an external data is outside of our code, we cannot control it. >> After compiled, we will have a RTL that will work follow the "-S" argument. >> >>> So the RTL will be adjusted in a way that it can be easily >>> compiled with String = UnicodeString or as is now with String = >>> AnsiString(CP_ACP). But we are not there yet. >> >> Now we're talking. >> Almost everyone that know how to work with "the group of strings", >> making them compatible between FPC and Delphi, are saying that Unicode >> is already done and everything is fine. You are the first one to say >> that is not complete yet. Thank you. I'm glad to know that I'm not >> crazy. > > Unicode itself is working, but in the form of UTF-8, not UTF-16 and as > such it is as compatible to Delphi as it can currently get with some > caveats when the specific type is important. Well, I only setted {mode delphi} and {modeswitch unicodestrings} and I did not leave Lazarus and still got strange results... looks like FPC flags is not compatible with itself or Lazarus. Again, I know that you, Mattias and many others understand that perfectly. But my examples were very simple, but they didn't work perfectly using just FPC and Lazarus. Regards, Marcos Douglas From md at delfire.net Tue Sep 26 00:04:29 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 19:04:29 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: <52b7765f-d57f-7c2b-f170-e57ec0499079@googlemail.com> References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> <52b7765f-d57f-7c2b-f170-e57ec0499079@googlemail.com> Message-ID: On Mon, Sep 25, 2017 at 6:23 PM, Sven Barth via Lazarus wrote: > On 25.09.2017 23:11, Marcos Douglas B. Santos via Lazarus wrote: >>>> [...] >>> The flags are -MDelphiUnicode, -MDelphi or -MObjFPC. >>> But they only compile the units with sources in the unit path, which >>> excludes all FPC units. Also keep in mind that the system unit and the >>> RTL require a lot of low level functions, which require separate >>> versions. >> >> Which make this flags useless for that. It should be all code (my, >> RTL, Lazarus, etc) to make this work using one type of string. > > No, because especially the RTL and FCL is usually provided precompiled. > Thus you can't change the string type anymore afterwards without > recompiling all the code. That's I am talking about. I use FPC and Lazarus by sources. I compile both. Never used an installer... Maybe you already answered in other way, but: In that case, can I compile FPC and Lazarus with these flags (all strings=UnicodeString) and everything will work like that? >> I can help in a high level way (Classes, Components, etc) not in the >> compiler level. >> But how can I know about these tasks? May I just pick one in bug >> tracker that I want? How to know who is working on each task, which is >> more important? > > Currently noone is working on it. :-O > A first step would be to add modeswitch headers to all units that must > not use a specific mode (e.g. the System, ObjPas and some more language > support units) like this: > > === code begin === > > {$ifdef FPC_UNICODE_RTL} > {$modeswitch unicodestrings} > {$endif} > > === code end === > > Once this is done one can test to compile the RTL, FCL and packages with > FPC_UNICODE_RTL defined and see what blows and fix that step by step... > > Alternatively a constant in the System unit might be better so that one > can check like this: > > === code begin === > > // System unit > {$ifdef FPC_UNICODE_RTL} > FpcRtlIsUnicode = true; > {$else} > FpcRtlIsUnicode = false; > {$endif} > > // some other unit > {$if FpcRtlIsUnicode} > {$modeswitch unicodestrings} > {$endif} > > === code end === I've put {$modeswitch unicodestrings} in two simple programs (CLI and GUI) and... CRASH! Imagine working with this on the compiler level... :) My first thought about is that: Every argument of all classes and functions should be raw string — RawByteString. May have some other types (UTF8String, UTF16String, etc) only for users to use in the high level. For example: If the user know that a file was encoded in UFT8, he/she will use UTF8String only to receive that buffer. Then, every single RTL class/function that works with Strings, should check which encode was used (and we already have this today). These functions will received an "string", will check which encode is (ie, UTF8String following the example), and will pass to another built-in private function to do the job. "UnicodeString", as we know today, shouldn't exists. This does not make any sense. Only RawByteString — which should be only "string" — and others types that defines the encode, as I said above, but used only once to receive the buffer. > Or if one wants to compile with -Municodestrings than instead the core > units need to be protected with > > === code begin === > > {$modeswitch unicodestrings-} > > === code end === > > I'm currently not sure what would be the better approach in the long > term... :/ Just guessing: The default is not Unicode so, shouldn't have logic to use {$modeswitch unicodestrings-}. Regards, Marcos Douglas From juha.manninen62 at gmail.com Tue Sep 26 00:52:14 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Tue, 26 Sep 2017 01:52:14 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: Marcos Douglas, this wiki page answers all your questions about using Unicode with Lazarus: http://wiki.freepascal.org/Unicode_Support_in_Lazarus On Mon, Sep 25, 2017 at 9:19 PM, Ondrej Pokorny via Lazarus wrote: > You will have to write your own methods with IFDEF-ed code for things > where it matters (read/write from/to buffer, char-by-char iterations etc.). For iterating codepoints or even "Unicode characters" (*) you don't need IFDEFs. Unit LazUnicode provides helper functions and iterators for it. (*) Unicode character here includes combining codepoints which covers most practical use cases at least with western languages. Juha From juha.manninen62 at gmail.com Tue Sep 26 01:01:04 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Tue, 26 Sep 2017 02:01:04 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: And more ... Marcos Douglas, the Unicode solution in Lazarus works amazingly well when your data is Unicode from the start. It only has trouble with Windows system codepages but they can be converted, too. Question: what is the fundamental problem? Why can't you use the system as it is advertised and documented? Juha From md at delfire.net Tue Sep 26 02:14:10 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 21:14:10 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Mon, Sep 25, 2017 at 7:52 PM, Juha Manninen via Lazarus wrote: > Marcos Douglas, this wiki page answers all your questions about using > Unicode with Lazarus: > http://wiki.freepascal.org/Unicode_Support_in_Lazarus OK, let's talk: 1. "Using UTF-8 in non-LCL programs" "In a non-LCL project add a dependency for LazUtils package. Then add LazUTF8 unit in the uses section of main program file. It must be near the beginning, just after the critical memory managers and threading stuff (e.g. cmem, heaptrc, cthreads)." Indeed, that was very good. Thanks. That solved one of my questions. I tested and it worked perfectly. I would say that should be part of compiler, not in a Lazarus package, because this is a basic thing that should work without other "3rd lib". 2. "Assign a constant always to a type String variable." So, you mean that I cannot declare a constant without specify the type. The language allow me but it won't work? 3. "Calling API functions that use WideString or UnicodeString" "When a parameter type is WideString or UnicodeString, you can just pass a String to it. The compiler converts data automatically. There will be a warning about converting from AnsiString to UnicodeString which can be either ignored or suppressed by typecasting the String to UnicodeString." Then the example: === code begin === procedure ApiCall(aParam: UnicodeString); // Definition. ... ApiCall(S); // Call with String S, ignore warning. ApiCall(UnicodeString(S)); // Call with String S, suppress warning. === code end === All these warnings is so annoying. I understood the point here, but I don't like to see any hint or warning. I need to solve all. But, I am in doubt about what is more annoying: typecasting all arguments or ignore all. 3.1. "When a parameter type is a pointer PWideChar, you need a temporary UnicodeString variable. Assign your String to it. The compiler then converts its data. Then typecast the temporary variable to PWideChar." === code begin === procedure ApiCallP(aParamP: PWideChar); // Definition. ... var Tmp: UnicodeString; // Temporary variable. ... Tmp := S; // Assign String -> UnicodeString. ApiCallP(PWideChar(Tmp)); // Call with temp variable, typecast to pointer. === code end === That is a ugly hack. This code doesn't make any sense, if you don't know about these Unicode issues. We need do remember that trick when we are coding... not good. 4. "Reading / writing text file with Windows codepage" "This is not compatible with Delphi nor with former Lazarus code. In practice you must encapsulate the code dealing with system codepage and convert the data to UTF-8 as quickly as possible." The text said: "This is not compatible with Delphi ". Examples on that page are hacks. 5. "CodePoint functions for encoding agnostic code" I liked to know that exists an unit to work with Code Point which is agnostic if the encoding is UTF8 or UTF16. I will use it. Thanks again. On Mon, Sep 25, 2017 at 8:01 PM, Juha Manninen via Lazarus wrote: > And more ... > > Marcos Douglas, the Unicode solution in Lazarus works amazingly well > when your data is Unicode from the start. > It only has trouble with Windows system codepages but they can be > converted, too. Nowadays, I'm only using Windows so... > Question: what is the fundamental problem? Why can't you use the > system as it is advertised and documented? I've already wrote my issues from the first email. Please, see the first email and then, one of my answer to Mattias about WideString, DOM, etc. Summary: I know that was a huge work for who made that. Lazarus is more Unicode, more compatible with Delphi, and the team could move on. Great. But you might agree with me that this is far from a good design, right? Best regards, Marcos Douglas From juha.manninen62 at gmail.com Tue Sep 26 02:52:43 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Tue, 26 Sep 2017 03:52:43 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Tue, Sep 26, 2017 at 3:14 AM, Marcos Douglas B. Santos via Lazarus wrote: > So, you mean that I cannot declare a constant without specify the > type. The language allow me but it won't work? Yes you can declare a string constant without specifying the type. > 3.1. "When a parameter type is a pointer PWideChar, > you need a temporary UnicodeString variable. > ... > That is a ugly hack. This code doesn't make any sense, if you don't > know about these Unicode issues. > We need do remember that trick when we are coding... not good. It is not so ugly. It is actually an elegant solution. Just one assignment, using the FPC's automatic conversion in a clever way. No explicit conversion functions or anything. The "ugly" pointer typecast is needed always, also in Delphi. > 4. "Reading / writing text file with Windows codepage" > ... > The text said: "This is not compatible with Delphi ". > Examples on that page are hacks. The solution is to NOT use Windows codepages. They can be seen as a historical remain with severe inherent problems which are solved by Unicode already a long ago. Windows has supported full Unicode since year 2000, and supported UCS-2 before that. Why would anybody still use the historical Windows codepages? > Summary: > I know that was a huge work for who made that. Lazarus is more > Unicode, more compatible with Delphi, and the team could move on. > Great. > But you might agree with me that this is far from a good design, right? IMO it is not far from a good design. From FPC's point of view it is a hack but you can write 100% Delphi compatible code by following just few simple rules (and dumping the historical Windows codepages). Juha From md at delfire.net Tue Sep 26 03:37:43 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 25 Sep 2017 22:37:43 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Mon, Sep 25, 2017 at 9:52 PM, Juha Manninen via Lazarus wrote: > On Tue, Sep 26, 2017 at 3:14 AM, Marcos Douglas B. Santos via Lazarus > wrote: >> So, you mean that I cannot declare a constant without specify the >> type. The language allow me but it won't work? > > Yes you can declare a string constant without specifying the type. But according with this table, I shouldn't do that because so many problems could happen. http://wiki.freepascal.org/Unicode_Support_in_Lazarus#Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8 >> 3.1. "When a parameter type is a pointer PWideChar, >> you need a temporary UnicodeString variable. >> ... >> That is a ugly hack. This code doesn't make any sense, if you don't >> know about these Unicode issues. >> We need do remember that trick when we are coding... not good. > > It is not so ugly. It is actually an elegant solution. Just one > assignment, using the FPC's automatic conversion in a clever way. No > explicit conversion functions or anything. > The "ugly" pointer typecast is needed always, also in Delphi. The "ugly" is because we need to remember to do that instead of just assign the variable. IMHO, both design are wrong. But I understand that the problem is in the compiler — or RTL. >> 4. "Reading / writing text file with Windows codepage" >> ... >> The text said: "This is not compatible with Delphi ". >> Examples on that page are hacks. > > The solution is to NOT use Windows codepages. They can be seen as a > historical remain with severe inherent problems which are solved by > Unicode already a long ago. > Windows has supported full Unicode since year 2000, and supported > UCS-2 before that. > Why would anybody still use the historical Windows codepages? So, no problems here and the page is outdated. OK. >> Summary: >> I know that was a huge work for who made that. Lazarus is more >> Unicode, more compatible with Delphi, and the team could move on. >> Great. >> But you might agree with me that this is far from a good design, right? > > IMO it is not far from a good design. From FPC's point of view it is a > hack but you can write 100% Delphi compatible code by following just > few simple rules (and dumping the historical Windows codepages). Like I said, it's a hack. But, again, it was|is a great job. No doubt. Best regards, Marcos Douglas From badsectoracula at gmail.com Tue Sep 26 09:09:22 2017 From: badsectoracula at gmail.com (Kostas Michalopoulos) Date: Tue, 26 Sep 2017 10:09:22 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: I do not see how it is a hack, when you have a function taking a null terminated string of a specific character type (in this case PWideChar) and you only have the generic string type you don't know what format the underlying memory of the string is so you cannot pass it as a pointer to the function. In this case you need to convert to the explicit type. These are (potentially) two different types, they just happen to be strings. You could think of it as if you had a function Foo(VP: PSingle) and a variable V: Number where Number could be either Single or Double depending on some macro - but you don't know which one, so to avoid passing a Double you'd need to assign it to a temporary variable to convert it to the right type. There is nothing wrong or hacky with that approach, this is how working with functions that accept pointers work in general - you need to make sure that the pointer you pass in is of the correct type. On Tue, Sep 26, 2017 at 4:37 AM, Marcos Douglas B. Santos via Lazarus < lazarus at lists.lazarus-ide.org> wrote: > On Mon, Sep 25, 2017 at 9:52 PM, Juha Manninen via Lazarus > wrote: > > On Tue, Sep 26, 2017 at 3:14 AM, Marcos Douglas B. Santos via Lazarus > > wrote: > >> So, you mean that I cannot declare a constant without specify the > >> type. The language allow me but it won't work? > > > > Yes you can declare a string constant without specifying the type. > > But according with this table, I shouldn't do that because so many > problems could happen. > http://wiki.freepascal.org/Unicode_Support_in_Lazarus# > Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8 > > >> 3.1. "When a parameter type is a pointer PWideChar, > >> you need a temporary UnicodeString variable. > >> ... > >> That is a ugly hack. This code doesn't make any sense, if you don't > >> know about these Unicode issues. > >> We need do remember that trick when we are coding... not good. > > > > It is not so ugly. It is actually an elegant solution. Just one > > assignment, using the FPC's automatic conversion in a clever way. No > > explicit conversion functions or anything. > > The "ugly" pointer typecast is needed always, also in Delphi. > > The "ugly" is because we need to remember to do that instead of just > assign the variable. > IMHO, both design are wrong. But I understand that the problem is in > the compiler — or RTL. > > >> 4. "Reading / writing text file with Windows codepage" > >> ... > >> The text said: "This is not compatible with Delphi ". > >> Examples on that page are hacks. > > > > The solution is to NOT use Windows codepages. They can be seen as a > > historical remain with severe inherent problems which are solved by > > Unicode already a long ago. > > Windows has supported full Unicode since year 2000, and supported > > UCS-2 before that. > > Why would anybody still use the historical Windows codepages? > > So, no problems here and the page is outdated. OK. > > >> Summary: > >> I know that was a huge work for who made that. Lazarus is more > >> Unicode, more compatible with Delphi, and the team could move on. > >> Great. > >> But you might agree with me that this is far from a good design, right? > > > > IMO it is not far from a good design. From FPC's point of view it is a > > hack but you can write 100% Delphi compatible code by following just > > few simple rules (and dumping the historical Windows codepages). > > Like I said, it's a hack. But, again, it was|is a great job. No doubt. > > Best regards, > Marcos Douglas > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From juha.manninen62 at gmail.com Tue Sep 26 11:31:56 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Tue, 26 Sep 2017 12:31:56 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Tue, Sep 26, 2017 at 4:37 AM, Marcos Douglas B. Santos via Lazarus wrote: > But according with this table, I shouldn't do that because so many > problems could happen. > http://wiki.freepascal.org/Unicode_Support_in_Lazarus#Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8 No. It works when assigning to String and that is what matters. >> The solution is to NOT use Windows codepages. >> ... > So, no problems here and the page is outdated. OK. The page is correct but your code and/or data is outdated if it uses the Windows codepage encoding. :) Well, honestly, why do you still use it? Unicode has been around for decades. It solved all the horrible problems inherent to locale dependent codepages. Windows has supported full Unicode for ~18 years. Maybe there still is a valid reason to use codepages but I don't know what it is. > Like I said, it's a hack. But, again, it was|is a great job. No doubt. Yes. The wiki page lists 3 simple rules: * Normally use type "String" instead of UTF8String or UnicodeString. * Assign a constant always to a type String variable. * Use type UnicodeString explicitly for API calls that need it. For you I would add: * Use Unicode instead of Windows system codepages. With those rules the code is mostly compatible with Delphi. Not bad. Juha From juha.manninen62 at gmail.com Tue Sep 26 14:09:03 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Tue, 26 Sep 2017 15:09:03 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: On Tue, Sep 26, 2017 at 12:11 AM, Marcos Douglas B. Santos via Lazarus wrote: > Yeah, but DOM uses DOMString, which is WideString. > Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is > UTF8, but I cannot use this unit with XPath unit, which needs a > TXMLDocument that works with WideString... see my point? That is a problem. I guess you can use the units with Lazarus but it results to many conversions between encodings. It should be solved somehow. Juha From zeljko at holobit.net Tue Sep 26 18:29:32 2017 From: zeljko at holobit.net (zeljko) Date: Tue, 26 Sep 2017 18:29:32 +0200 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: <4d6b2e8d-9536-f163-ae0e-e77a09e7ad6c@holobit.net> On 26.09.2017 11:31, Juha Manninen via Lazarus wrote: > Maybe there still is a valid reason to use codepages but I don't know > what it is. POS receipt printers :) zeljko From md at delfire.net Tue Sep 26 21:51:33 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Tue, 26 Sep 2017 16:51:33 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: On Tue, Sep 26, 2017 at 6:31 AM, Juha Manninen via Lazarus wrote: > On Tue, Sep 26, 2017 at 4:37 AM, Marcos Douglas B. Santos via Lazarus > wrote: >> But according with this table, I shouldn't do that because so many >> problems could happen. >> http://wiki.freepascal.org/Unicode_Support_in_Lazarus#Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8 > > No. It works when assigning to String and that is what matters. I understood that I can use like this: const VALUE: string = 'áéíóú'; Not like this: const VALUE = 'áéíóú'; Right? But this is not compile: const V1: string = 'a'; V2: string = V1 + 'b'; >>> The solution is to NOT use Windows codepages. >>> ... >> So, no problems here and the page is outdated. OK. > > The page is correct but your code and/or data is outdated if it uses > the Windows codepage encoding. :) > Well, honestly, why do you still use it? > Unicode has been around for decades. It solved all the horrible > problems inherent to locale dependent codepages. Windows has supported > full Unicode for ~18 years. > Maybe there still is a valid reason to use codepages but I don't know > what it is. I don't use it. Regards, Marcos Douglas From md at delfire.net Tue Sep 26 21:52:33 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Tue, 26 Sep 2017 16:52:33 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: On Tue, Sep 26, 2017 at 9:09 AM, Juha Manninen via Lazarus wrote: > On Tue, Sep 26, 2017 at 12:11 AM, Marcos Douglas B. Santos via Lazarus > wrote: >> Yeah, but DOM uses DOMString, which is WideString. >> Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is >> UTF8, but I cannot use this unit with XPath unit, which needs a >> TXMLDocument that works with WideString... see my point? > > That is a problem. I guess you can use the units with Lazarus but it > results to many conversions between encodings. > It should be solved somehow. So we can say that Lazarus code do not use XPath to work with XML, right? Marcos Douglas From hdpc at talktalk.net Tue Sep 26 22:06:17 2017 From: hdpc at talktalk.net (Howard Page-Clark) Date: Tue, 26 Sep 2017 21:06:17 +0100 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: Message-ID: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> On 26/09/17 20:51, Marcos Douglas B. Santos via Lazarus wrote: > I understood that I can use like this: > const > VALUE: string = 'áéíóú'; > > Not like this: > const > VALUE = 'áéíóú'; > > Right? > But this is not compile: > const > V1: string = 'a'; > V2: string = V1 + 'b'; You can't do that in a const declaration. But in an implementation, the following does compile: {$J+} {$H+} const   V1: string = 'a';   V2: string = 'b';   V3: String = ''; begin   V3:=V1 + V2;   WriteLn(V3); end. From md at delfire.net Wed Sep 27 04:51:37 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Tue, 26 Sep 2017 23:51:37 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> References: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> Message-ID: On Tue, Sep 26, 2017 at 5:06 PM, Howard Page-Clark via Lazarus wrote: > On 26/09/17 20:51, Marcos Douglas B. Santos via Lazarus wrote: >> >> I understood that I can use like this: >> const >> VALUE: string = 'áéíóú'; >> >> Not like this: >> const >> VALUE = 'áéíóú'; >> >> Right? >> But this is not compile: >> const >> V1: string = 'a'; >> V2: string = V1 + 'b'; > > You can't do that in a const declaration. > But in an implementation, the following does compile: > > {$J+} {$H+} > const > V1: string = 'a'; > V2: string = 'b'; > V3: String = ''; > > begin > V3:=V1 + V2; > WriteLn(V3); > end. I know this trick that was deprecated a long time ago. A constant that can change... I think may be better not using constants in the code anymore. But thanks, anyway. Marcos Douglas From mailinglists at geldenhuys.co.uk Wed Sep 27 10:16:43 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 27 Sep 2017 09:16:43 +0100 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> Message-ID: On 2017-09-27 03:51, Marcos Douglas B. Santos via Lazarus wrote: > A constant that > can change... Yeah, that concept still blows my mind. [figuratively speaking] They should shoot the developer that came up with that idea - and the team leader that approved it. Regards, Graeme From friess at gmx.at Wed Sep 27 10:38:40 2017 From: friess at gmx.at (=?UTF-8?Q?Andreas_Frie=c3=9f?=) Date: Wed, 27 Sep 2017 10:38:40 +0200 Subject: [Lazarus] fpReport - can not render pagefooter Message-ID: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> i have extracted a small sample for fpReport and Lazarus. But i have trouble to declare a working Pagefooter. The Pagefooter is defined, but not shown after the rendering. Not in LCLrendering, LCLpreview nor in the PDF. The CreateDemoReport is extracted from the fpreportdesigner, so i think this is well tested :-) by graeme. What is my mistake of understanding ? Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: published.zip Type: application/x-zip-compressed Size: 4987 bytes Desc: not available URL: From juha.manninen62 at gmail.com Wed Sep 27 12:05:02 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Wed, 27 Sep 2017 13:05:02 +0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: On Tue, Sep 26, 2017 at 10:52 PM, Marcos Douglas B. Santos via Lazarus wrote: > So we can say that Lazarus code do not use XPath to work with XML, right? No I cannot say much about the issue. I didn't try it myself. I understood Mattias and Michael V.C. have plans to migrate the XML units to FCL sources. Maybe they can elaborate. > I don't use it. (Windows codepages) Ok, then I misunderstood. :) About the string constant concatenation, just use variables when it is proper: const V1: string = 'a'; var S1: String; ... later in code ... S1 := V1 + 'b'; String literals can be assigned without problems as long as your variables are "String". The big table in the wiki page is intimidating, in reality the issue is not so complex. On Tue, Sep 26, 2017 at 7:29 PM, zeljko wrote: > POS receipt printers :) Ok maybe. I don't have one, difficult to say. Juha From mailinglists at geldenhuys.co.uk Wed Sep 27 12:50:52 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Wed, 27 Sep 2017 11:50:52 +0100 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> Message-ID: <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: > What is my mistake of understanding ? You made a couple of mistakes and highlighted a bug in the PDF exporter. Mistakes: 1. You never registered the standard page sizes with: PaperManager.RegisterStandardSizes; 2. Your report used LiberationSans font. Make sure you added the search paths to the font cache. eg: {$IFDEF UNIX} gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); gTTFontCache.SearchPath.Add('/data/devel/Wisa/fonts/Liberation/'); {$ENDIF} 3. You positioned a lot of reporting elements overlapping each other. Correct positioning will help you see things better. ;-) Bug: The PDF exporter didn't handle Page.Orientation of Landscape correctly, and rendered such pages from the bottom upwards. I supplied a patch to FPC's Mantis so hopefully Michael or somebody could commit that soon. https://bugs.freepascal.org/view.php?id=32478 After all that, the report renders just fine. ps: Note that I compiled your project using the latest fpReport from FPC Trunk. I simply set the correct Unit Source Path in the project. You don't need to use FPC Trunk compiler - I used FPC 2.6.4. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From michael at freepascal.org Wed Sep 27 13:31:20 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Wed, 27 Sep 2017 13:31:20 +0200 (CEST) Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> Message-ID: On Wed, 27 Sep 2017, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: >> What is my mistake of understanding ? > > You made a couple of mistakes and highlighted a bug in the PDF exporter. > > Mistakes: > > 1. You never registered the standard page sizes with: > PaperManager.RegisterStandardSizes; > > 2. Your report used LiberationSans font. Make sure you added > the search paths to the font cache. eg: > > {$IFDEF UNIX} > gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); > > gTTFontCache.SearchPath.Add('/data/devel/Wisa/fonts/Liberation/'); > {$ENDIF} > > 3. You positioned a lot of reporting elements overlapping each > other. Correct positioning will help you see things better. ;-) > > > Bug: > > The PDF exporter didn't handle Page.Orientation of Landscape > correctly, and rendered such pages from the bottom upwards. > I supplied a patch to FPC's Mantis so hopefully Michael or > somebody could commit that soon. > > https://bugs.freepascal.org/view.php?id=32478 > > > After all that, the report renders just fine. Patch Applied, thanks for the fix! Michael. From friess at gmx.at Wed Sep 27 13:53:31 2017 From: friess at gmx.at (=?UTF-8?Q?Andreas_Frie=c3=9f?=) Date: Wed, 27 Sep 2017 13:53:31 +0200 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> Message-ID: <9613ee3b-460c-18b7-6724-96147bb41362@gmx.at> THX Graeme In windows this is possible and running: -> I have my sample extended procedure TForm1.FormActivate(Sender: TObject); begin   if not FInit then begin     gTTFontCache.ReadStandardFonts;     gTTFontCache.BuildFontCache;     if PaperManager.PaperCount=0 then       PaperManager.RegisterStandardSizes;     FInit:= true;   end; end; The problem with fontcache, is not (maybe direct) visible in the demo on FPReport Usage. BTW: point 3 -> the code is copied direct from the 'designer' :-) not made on my own - lol. Bugreport for the designer problem with orientation is 32470, i will check this and close if running. Andreas Am 27.09.2017 um 12:50 schrieb Graeme Geldenhuys via Lazarus: > On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: >> What is my mistake of understanding ? > > You made a couple of mistakes and highlighted a bug in the PDF exporter. > > Mistakes: > > 1.  You never registered the standard page sizes with: >          PaperManager.RegisterStandardSizes; > > 2.  Your report used LiberationSans font. Make sure you added >     the search paths to the font cache. eg: > >           {$IFDEF UNIX} >             gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); > > gTTFontCache.SearchPath.Add('/data/devel/Wisa/fonts/Liberation/'); >           {$ENDIF} > > 3.  You positioned a lot of reporting elements overlapping each >     other. Correct positioning will help you see things better. ;-) > > > Bug: > >    The PDF exporter didn't handle Page.Orientation of Landscape >    correctly, and rendered such pages from the bottom upwards. >    I supplied a patch to FPC's Mantis so hopefully Michael or >    somebody could commit that soon. > >       https://bugs.freepascal.org/view.php?id=32478 > > > After all that, the report renders just fine. > > > ps: >   Note that I compiled your project using the latest fpReport from >   FPC Trunk. I simply set the correct Unit Source Path in the project. >   You don't need to use FPC Trunk compiler - I used FPC 2.6.4. > > > Regards, >   Graeme > From md at delfire.net Wed Sep 27 14:24:10 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 27 Sep 2017 09:24:10 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> Message-ID: On Wed, Sep 27, 2017 at 5:16 AM, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-27 03:51, Marcos Douglas B. Santos via Lazarus wrote: >> >> A constant that >> can change... > > > > Yeah, that concept still blows my mind. [figuratively speaking] They should > shoot the developer that came up with that idea - and the team leader that > approved it. Everybody has crazy ideias... the problem is who sign them saying "yeah, go ahead!" :) Regards, Marcos Douglas From md at delfire.net Wed Sep 27 14:35:30 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Wed, 27 Sep 2017 09:35:30 -0300 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <4bd14a3a-480e-62ea-7962-2f64cd47d4d6@googlemail.com> <20170925224503.7d95cddf@limapholos.matflo.wg> Message-ID: On Wed, Sep 27, 2017 at 7:05 AM, Juha Manninen via Lazarus wrote: > On Tue, Sep 26, 2017 at 10:52 PM, Marcos Douglas B. Santos via Lazarus > [...] > About the string constant concatenation, just use variables when it is proper: > const > V1: string = 'a'; > var > S1: String; > ... later in code ... > S1 := V1 + 'b'; > > String literals can be assigned without problems as long as your > variables are "String". > The big table in the wiki page is intimidating, in reality the issue > is not so complex. I'm already doing that. This not perfect, but is better than have problems. Thanks. Best regards, Marcos Douglas From el.es.cr at gmail.com Thu Sep 28 10:10:21 2017 From: el.es.cr at gmail.com (el es) Date: Thu, 28 Sep 2017 09:10:21 +0100 Subject: [Lazarus] Converting all code to use UnicodeString In-Reply-To: References: <75baa739-b22e-fe2e-39be-8ce805325dcd@talktalk.net> Message-ID: On 27/09/17 09:16, Graeme Geldenhuys via Lazarus wrote: > On 2017-09-27 03:51, Marcos Douglas B. Santos via Lazarus wrote: >> A constant that can change... > > > Yeah, that concept still blows my mind. [figuratively speaking] They > should shoot the developer that came up with that idea - and the team > leader that approved it. > > Regards, Graeme > comp.compilers.free-pascal.social is leaking ;) It dates back to when, Turbo Pascal ? Late 1980s / Early 1990s ? Imagine this: Developer (thinking): "The rave was great last weekend, still feeling the pain Thursday" Developer: " we have this almost ready and this looks like a great idea" Supervisor (thinking): "Ah the world's going to end next week anyway, who cares" Supervisor: "OK, make it so" ;) -L. From andrea.mauri.75 at gmail.com Thu Sep 28 12:05:44 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Thu, 28 Sep 2017 12:05:44 +0200 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> Message-ID: <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Il 27/09/2017 12:50, Graeme Geldenhuys via Lazarus ha scritto: > ps: > Note that I compiled your project using the latest fpReport from > FPC Trunk. I simply set the correct Unit Source Path in the project. > You don't need to use FPC Trunk compiler - I used FPC 2.6.4. What are the minimum requirements to use fpreport? Can I use it with laz 1.6.2 and fpc 3.0.0? I downloaded both fcl-report and fpreport. I tried to install fpreport but I failed. Any hint? From michael at freepascal.org Thu Sep 28 12:15:18 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 28 Sep 2017 12:15:18 +0200 (CEST) Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Message-ID: On Thu, 28 Sep 2017, Andrea Mauri via Lazarus wrote: > Il 27/09/2017 12:50, Graeme Geldenhuys via Lazarus ha scritto: >> ps: >> Note that I compiled your project using the latest fpReport from >> FPC Trunk. I simply set the correct Unit Source Path in the project. >> You don't need to use FPC Trunk compiler - I used FPC 2.6.4. > > What are the minimum requirements to use fpreport? > Can I use it with laz 1.6.2 and fpc 3.0.0? > I downloaded both fcl-report and fpreport. > I tried to install fpreport but I failed. Normally you can, but you will need to copy some additional units from the trunk version of the FPC source repo (in particular, fpexprpars, and fcl-pdf) fpReport is in production use with 2.6.4 as the compiler. Michael. From fjf.vanleeuwen at quicknet.nl Thu Sep 28 12:20:28 2017 From: fjf.vanleeuwen at quicknet.nl (frans) Date: Thu, 28 Sep 2017 12:20:28 +0200 Subject: [Lazarus] Why is OnShow not executed? Message-ID: <5f6988f7-8778-fd62-b003-07740d02c7e4@quicknet.nl> Hi I'm using Lazarus 1.6.4 on Windows. I have a Form with a TPageControl with 5 tabsheet components. Every tab has his own OnShow procedure to set the latest data in the fields. Every time the Form is shown I want the first tab to become visible. Therefore the FormShow calls tab0.Show. The first time the form shows it goes as I expect, the tab0 OnShow procedure is called and the data is set. But when I close the form while showing the tab0, and then later opens it again, the FormShow is executed but tab0 OnShow is not. Apparently the program 'sees' that tab0 is already shown, so executing tab0.Show is not necessary. Is this as it should be? To always execute the tab0 OnShow procedure I must call this directly. Is this the correct way? -- mvg Frans van Leeuwen M 06-51695390 --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com From vojtech.cihak at atlas.cz Thu Sep 28 13:30:33 2017 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Thu, 28 Sep 2017 13:30:33 +0200 Subject: [Lazarus] =?utf-8?q?Why_is_OnShow_not_executed=3F?= In-Reply-To: 000000007d3f00005b40013a5054 References: 000000007d3f00005b40013a5054 Message-ID: <20170928133033.04C157E8@atlas.cz> Hi, just tested, it is same in Delphi7. Refresh data manually in FormShow is one of correct ways.   V. ______________________________________________________________ > Od: frans via Lazarus > Komu: lazarus at lists.lazarus-ide.org > Datum: 28.09.2017 12:20 > Předmět: [Lazarus] Why is OnShow not executed? > Hi I'm using Lazarus 1.6.4 on Windows. I have a Form with a TPageControl with 5 tabsheet components. Every tab has his own OnShow procedure to set the latest data in the fields. Every time the Form is shown I want the first tab to become visible. Therefore the FormShow calls tab0.Show. The first time the form shows it goes as I expect, the tab0 OnShow procedure is called and the data is set. But when I close the form while showing the tab0, and then later opens it again, the FormShow is executed but tab0 OnShow is not. Apparently the program 'sees' that tab0 is already shown, so executing tab0.Show is not necessary. Is this as it should be? To always execute the tab0 OnShow procedure I must call this directly. Is this the correct way? -- mvg Frans van Leeuwen M 06-51695390 --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com -- _______________________________________________ Lazarus mailing list Lazarus at lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.mauri.75 at gmail.com Thu Sep 28 13:36:15 2017 From: andrea.mauri.75 at gmail.com (Andrea Mauri) Date: Thu, 28 Sep 2017 13:36:15 +0200 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Message-ID: Il 28/09/2017 12:15, Michael Van Canneyt via Lazarus ha scritto: > Normally you can, but you will need to copy some additional units from the > trunk version of the FPC source repo (in particular, fpexprpars, and > fcl-pdf) > > fpReport is in production use with 2.6.4 as the compiler. I downloaded fcl-report, fcl-pdf, fpexprpars from FPC trunk and fpreport. When I try to compile lclfpreport package I got: cfgfpreportimageexport.pp(24,42) Fatal: Cannot find fpreport used by cfgfpreportimageexport of package lclfpreport. From michael at freepascal.org Thu Sep 28 13:40:32 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 28 Sep 2017 13:40:32 +0200 (CEST) Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Message-ID: On Thu, 28 Sep 2017, Andrea Mauri via Lazarus wrote: > Il 28/09/2017 12:15, Michael Van Canneyt via Lazarus ha scritto: >> Normally you can, but you will need to copy some additional units from the >> trunk version of the FPC source repo (in particular, fpexprpars, and >> fcl-pdf) >> >> fpReport is in production use with 2.6.4 as the compiler. > > I downloaded fcl-report, fcl-pdf, fpexprpars from FPC trunk and fpreport. > When I try to compile lclfpreport package I got: > cfgfpreportimageexport.pp(24,42) Fatal: Cannot find fpreport used by > cfgfpreportimageexport of package lclfpreport. Sounds like a misconfigured path. Hard to debug, because there is also the 8.3 filename support that interferes. How I cursed that while developing fpreport !! :/ Michael. From aaa5500 at ya.ru Thu Sep 28 14:35:38 2017 From: aaa5500 at ya.ru (Alexey) Date: Thu, 28 Sep 2017 15:35:38 +0300 Subject: [Lazarus] MainMenu dropped to the left, Win bug? Message-ID: <6b4c1d61-0ebf-d9ce-b009-e45ad9ae7ce2@ya.ru> User reported this bug here: https://github.com/Alexey-T/CudaText/issues/1101 -- Regards, Alexey From michael at freepascal.org Thu Sep 28 14:37:43 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 28 Sep 2017 14:37:43 +0200 (CEST) Subject: [Lazarus] MainMenu dropped to the left, Win bug? In-Reply-To: <6b4c1d61-0ebf-d9ce-b009-e45ad9ae7ce2@ya.ru> References: <6b4c1d61-0ebf-d9ce-b009-e45ad9ae7ce2@ya.ru> Message-ID: On Thu, 28 Sep 2017, Alexey via Lazarus wrote: > User reported this bug here: > > https://github.com/Alexey-T/CudaText/issues/1101 That can happen if OS decides there is not enough room on the right ? Michael. From dezlov at gmail.com Thu Sep 28 15:32:40 2017 From: dezlov at gmail.com (Denis Kozlov) Date: Thu, 28 Sep 2017 14:32:40 +0100 Subject: [Lazarus] MainMenu dropped to the left, Win bug? In-Reply-To: <6b4c1d61-0ebf-d9ce-b009-e45ad9ae7ce2@ya.ru> References: <6b4c1d61-0ebf-d9ce-b009-e45ad9ae7ce2@ya.ru> Message-ID: On 28/09/2017 13:35, Alexey via Lazarus wrote: > User reported this bug here: > > https://github.com/Alexey-T/CudaText/issues/1101 Maybe a "handedness" setting? https://www.top-password.com/blog/fix-windows-10-opens-right-click-context-menu-to-left-side/ Denis From md at delfire.net Thu Sep 28 15:35:40 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 28 Sep 2017 10:35:40 -0300 Subject: [Lazarus] Kitto2 for Rich Internet Applications Message-ID: Hi, I would like to know if anybody here has already used Kitto2 https://github.com/EtheaDev/kitto2 This project used or was based on the old ExtPascal. My question is because this project compiles only in Delphi and maybe somebody here has already ported to FPC or thought on it. I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about this. Best regards, Marcos Douglas From michael at freepascal.org Thu Sep 28 15:43:02 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 28 Sep 2017 15:43:02 +0200 (CEST) Subject: [Lazarus] Kitto2 for Rich Internet Applications In-Reply-To: References: Message-ID: On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > Hi, > > I would like to know if anybody here has already used Kitto2 > https://github.com/EtheaDev/kitto2 > This project used or was based on the old ExtPascal. > > My question is because this project compiles only in Delphi and maybe > somebody here has already ported to FPC or thought on it. > > I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about this. Kitto2 is a dead end, just as ExtPascal was. Nevertheless, now that Embarcadero embraced it, I doubt they will consider porting to FPC. Michael. From md at delfire.net Thu Sep 28 16:14:54 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 28 Sep 2017 11:14:54 -0300 Subject: [Lazarus] Kitto2 for Rich Internet Applications In-Reply-To: References: Message-ID: On Thu, Sep 28, 2017 at 10:43 AM, Michael Van Canneyt via Lazarus wrote: > > > On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > >> Hi, >> >> I would like to know if anybody here has already used Kitto2 >> https://github.com/EtheaDev/kitto2 >> This project used or was based on the old ExtPascal. >> >> My question is because this project compiles only in Delphi and maybe >> somebody here has already ported to FPC or thought on it. >> >> I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about >> this. > > > Kitto2 is a dead end, just as ExtPascal was. They removed ExtPascal from it... but I've never tried Kitto2. > Nevertheless, now that Embarcadero embraced it, I doubt they will consider > porting to FPC. The author have no objections... But if you say that FPC already has something better (December, right?), I'll choose fcl-web, of course. (and I do not saying that I will use Kitto2... was just to know) Best regards, Marcos Douglas From michael at freepascal.org Thu Sep 28 16:43:04 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 28 Sep 2017 16:43:04 +0200 (CEST) Subject: [Lazarus] Kitto2 for Rich Internet Applications In-Reply-To: References: Message-ID: On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > On Thu, Sep 28, 2017 at 10:43 AM, Michael Van Canneyt via Lazarus > wrote: >> >> >> On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: >> >>> Hi, >>> >>> I would like to know if anybody here has already used Kitto2 >>> https://github.com/EtheaDev/kitto2 >>> This project used or was based on the old ExtPascal. >>> >>> My question is because this project compiles only in Delphi and maybe >>> somebody here has already ported to FPC or thought on it. >>> >>> I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about >>> this. >> >> >> Kitto2 is a dead end, just as ExtPascal was. > > They removed ExtPascal from it... but I've never tried Kitto2. What I meant is that I believe the architecture is simply wrong. >> Nevertheless, now that Embarcadero embraced it, I doubt they will consider >> porting to FPC. > > The author have no objections... > But if you say that FPC already has something better (December, > right?), I'll choose fcl-web, of course. I believe it is better, yes. We managed to convince a major component developer of this, so we're not alone in this belief :) Michael. From md at delfire.net Thu Sep 28 17:06:01 2017 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 28 Sep 2017 12:06:01 -0300 Subject: [Lazarus] Kitto2 for Rich Internet Applications In-Reply-To: References: Message-ID: On Thu, Sep 28, 2017 at 11:43 AM, Michael Van Canneyt via Lazarus wrote: > > On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: > >>[...] >> But if you say that FPC already has something better (December, >> right?), I'll choose fcl-web, of course. > > > I believe it is better, yes. > > We managed to convince a major component developer of this, so we're not > alone in this belief :) WOW! Good to know. Thanks Michael. Regards, Marcos Douglas From mschnell at lumino.de Fri Sep 29 10:20:35 2017 From: mschnell at lumino.de (Michael Schnell) Date: Fri, 29 Sep 2017 10:20:35 +0200 Subject: [Lazarus] Kitto2 for Rich Internet Applications In-Reply-To: References: Message-ID: On 28.09.2017 15:35, Marcos Douglas B. Santos via Lazarus wrote: > https://github.com/EtheaDev/kitto2 Seems like an interesting project. I once did some rather successful tests with ExtPascal but gave up as ExtPascal seemed to be dead. Now at -> http://www.ethea.it/eng_news.htm we read: "September 2017: Kitto^2 and Kide^2 released under Open Source license!" So trying it with fpc/Lazarus seems viable. -Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From janusz.chmiel at volny.cz Fri Sep 29 17:59:37 2017 From: janusz.chmiel at volny.cz (Mgr. Janusz Chmiel) Date: Fri, 29 Sep 2017 17:59:37 +0200 Subject: [Lazarus] Accessibility enhacement request Lazarus version 1.7 Message-ID: Dear specialists, My name is Janusz Chmiel. I Am visually impaired user of Lazarus. My dream is to use yours development environment to create professional Android applications. But to make not only my dream to come true, it is necessary to find out, if editable field for editing source code can be make screen reader compatible. I AM ready to even test bleeding edge code from SVN. My only one question is, if it is possible tomake this component accessible. Because in general, Lazarus IDE is quite accessible. But The biggest accessibility issue is editable field for writing and editing source code. Any advice will be very welcomed. I will do my best with The cooperation with engaged developers to make yours product accessible for visually impaired programmer. I Am advanced user so I AM really ready to constructively help in this problem not only by submitting it,but I will cooperate with you on A solution. Thank you very much for yours time and help to The visually impaired users of Lazarus. With The warmest regards. Mgr. Janusz Chmiel, Brno. From mailinglists at geldenhuys.co.uk Fri Sep 29 21:53:38 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 29 Sep 2017 20:53:38 +0100 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Message-ID: <6d27cc0c-8ce9-9fd7-0492-767b171310f2@geldenhuys.co.uk> On 2017-09-28 11:05, Andrea Mauri via Lazarus wrote: > What are the minimum requirements to use fpreport? > Can I use it with laz 1.6.2 and fpc 3.0.0? I don't track the lazarus version I use, but I'm using fpreport (from FPC Trunk) with FPC 2.6.4. On a side note: I did notice recently that there was some FPC Trunk changes of fpReport that breaks FPC 2.6.4 support, but it was a single IFDEF to fix the issue locally. I'll submit a patch for that tomorrow on Mantis. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp From mailinglists at geldenhuys.co.uk Fri Sep 29 21:55:38 2017 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Fri, 29 Sep 2017 20:55:38 +0100 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> <05a5e00d-352d-d614-d87f-acc5198d0bbe@gmail.com> Message-ID: <89c87f06-83d7-4f20-fdcb-762c4e01b2c8@geldenhuys.co.uk> On 2017-09-28 12:40, Michael Van Canneyt via Lazarus wrote: > because there is also the 8.3 filename support that > interferes. Oh yeah, I completely forgot about those platforms. :-/ Regards, Graeme From vojtech.cihak at atlas.cz Sat Sep 30 02:59:29 2017 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sat, 30 Sep 2017 02:59:29 +0200 Subject: [Lazarus] =?utf-8?q?UTF8Tools_problem?= Message-ID: <20170930025929.17A34D5B@atlas.cz> Hi,   I have this code for improved autocomplete of TCombo:   var i, aCharMatch, aIndex: Integer;     aCmbText, aItemStr: TUTF8Scanner;     aStr: string; begin   with TStringGrid(TComboBox(Sender).Parent) do     if TComboBox(Sender).ItemIndex>=0       then Cells[Col, Row]:=TComboBox(Sender).Items[TComboBox(Sender).ItemIndex]  { item matched by Combo }       else        begin  { try match item by UTF8Scanner }         if TComboBox(Sender).Items.Count>0 then           begin             aIndex:=0;              aStr:=UTF8lowercase(trim(TComboBox(Sender).Text));             if aStr<>'' then               begin                 aCmbText:=TUTF8Scanner.Create(aStr);                 aItemStr:=TUTF8Scanner.Create;                    aCharMatch:=1;                 for i:=0 to TComboBox(Sender).Items.Count-1 do                   begin                     aItemStr.UTF8String:=UTF8lowercase(TComboBox(Sender).Items[i]);                     while (not aCmbText.Done) and (not aItemStr.Done) do                       begin                         if aCmbText.Next=aItemStr.Next then                           if aCmbText.CharPos>aCharMatch then                             begin                               inc(aCharMatch);                               aIndex:=i;                             end;                       end;                     aCmbText.Reset;                   end;                  aCmbText.Free;                 aItemStr.Free;                  end;             TComboBox(Sender).ItemIndex:=aIndex;             Cells[Col, Row]:=TComboBox(Sender).Items[aIndex];           end;       end;                  It uses UTF8tools http://wiki.lazarus.freepascal.org/UTF8_Tools by Theo. I tried to compile project after while (few month) and I have got this error message:   unicodeinfo.pas(1180,53) Error: Wrong number of parameters specified for call to "UnicodeToUtf8" Error: Found declaration: UnicodeToUtf8(PChar;PUnicodeChar;Int64):Int64;   Question is: How can I repair unicodeinfo.pas? Or better, can I do the same job without UTF8Tools package?   Thanks for help,   V. -------------- next part -------------- An HTML attachment was scrubbed... URL: From friess at gmx.at Sat Sep 30 09:18:19 2017 From: friess at gmx.at (Andreas =?UTF-8?B?RnJpZcOf?=) Date: Sat, 30 Sep 2017 09:18:19 +0200 Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> Message-ID: Is it possible to make a FAQ for fpreport ? Regards Andreas Graeme Geldenhuys via Lazarus wrote: > On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: > > What is my mistake of understanding ? > > You made a couple of mistakes and highlighted a bug in the PDF > exporter. > > Mistakes: > ... > > Regards, > Graeme From juha.manninen62 at gmail.com Sat Sep 30 09:27:02 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sat, 30 Sep 2017 10:27:02 +0300 Subject: [Lazarus] UTF8Tools problem In-Reply-To: <20170930025929.17A34D5B@atlas.cz> References: <20170930025929.17A34D5B@atlas.cz> Message-ID: On Sat, Sep 30, 2017 at 3:59 AM, Vojtěch Čihák via Lazarus wrote: > unicodeinfo.pas(1180,53) Error: Wrong number of parameters specified for > call to "UnicodeToUtf8" > > Error: Found declaration: UnicodeToUtf8(PChar;PUnicodeChar;Int64):Int64; I downloaded UTF8tools from the wiki page and compiled it without problems. I don't see UnicodeToUtf8 with 3 parameters anywhere. LazUTF8 has 2 versions: function UnicodeToUTF8(CodePoint: cardinal): string; // UTF32 to UTF8 function UnicodeToUTF8(CodePoint: cardinal; Buf: PChar): integer; // UTF32 to UTF8 > Question is: How can I repair unicodeinfo.pas? unicodeinfo.pas looks OK. You have another version of UnicodeToUtf8() coming from somewhere. > Or better, can I do the same job without UTF8Tools package? Unit LazUnicode has iterators for both codepoints and Unicode "characters". Juha From michael at freepascal.org Sat Sep 30 09:43:27 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 30 Sep 2017 09:43:27 +0200 (CEST) Subject: [Lazarus] fpReport - can not render pagefooter In-Reply-To: References: <9809112f-4049-e23e-96c9-cf5bb223eaee@gmx.at> <6b834eea-c132-f0be-c15d-2f65e7a52168@geldenhuys.co.uk> Message-ID: Sure. You can add pages to the wiki about fpreport: http://wiki.freepascal.org/FPReport I suggest adding a new page http://wiki.freepascal.org/FPReport_FAQ and linking to it from the main page. But don't add the FAQ directly in the main page itself. Michael. On Sat, 30 Sep 2017, Andreas Frieß via Lazarus wrote: > Is it possible to make a FAQ for fpreport ? > > Regards > Andreas > > Graeme Geldenhuys via Lazarus wrote: > >> On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: >>> What is my mistake of understanding ? >> >> You made a couple of mistakes and highlighted a bug in the PDF >> exporter. >> >> Mistakes: >> > ... >> >> Regards, >> Graeme > > > From vojtech.cihak at atlas.cz Sat Sep 30 14:38:24 2017 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sat, 30 Sep 2017 14:38:24 +0200 Subject: [Lazarus] =?utf-8?q?UTF8Tools_problem?= In-Reply-To: 000000007d58000091d4013a502f References: <20170930025929.17A34D5B@atlas.cz> 000000007d58000091d4013a502f Message-ID: <20170930143824.2BE10CC9@atlas.cz> Thanks, I had old version of UTF8Tools which didn't have LazUTF8 in "uses" so it poited to FPC's:   function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif} function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;    Now it works.   I'll look on the solution via LazUnicode too, it would reduce one dependency on external package.   V.     ___________________________________________________________ > Od: Juha Manninen via Lazarus > Komu: Lazarus mailing list > Datum: 30.09.2017 09:27 > Předmět: Re: [Lazarus] UTF8Tools problem > On Sat, Sep 30, 2017 at 3:59 AM, Vojtěch Čihák via Lazarus wrote: ..... Juha -- _______________________________________________ Lazarus mailing list Lazarus at lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaa5500 at ya.ru Sat Sep 30 18:42:39 2017 From: aaa5500 at ya.ru (Alexey) Date: Sat, 30 Sep 2017 19:42:39 +0300 Subject: [Lazarus] Custom component: cannot make Items: TStrings Message-ID: <02a6c7e9-cba4-6f89-f99d-710b1355b10f@ya.ru> Hi. I added to ATTabs prop Items: TStrings. It has getter/setter. It has registering in IDE. - in designer, OI can set Items and tabs appear - if i run app, tabs dont appear- ?? - if I restart IDE, app's LFM looses Items- ?? https://github.com/alexey-t/attabs -- Regards, Alexey From r030t1 at gmail.com Sat Sep 30 19:15:32 2017 From: r030t1 at gmail.com (R0b0t1) Date: Sat, 30 Sep 2017 12:15:32 -0500 Subject: [Lazarus] Accessibility enhacement request Lazarus version 1.7 In-Reply-To: References: Message-ID: On Friday, September 29, 2017, Mgr. Janusz Chmiel via Lazarus < lazarus at lists.lazarus-ide.org> wrote: > Dear specialists, > My name is Janusz Chmiel. I Am visually impaired user of Lazarus. My dream is to use yours development environment to create professional Android applications. But to make not only my dream to come true, it is necessary to find out, if editable field for editing source code can be make screen reader compatible. > I AM ready to even test bleeding edge code from SVN. My only one question is, if it is possible tomake this component accessible. > Because in general, Lazarus IDE is quite accessible. But The biggest accessibility issue is editable field for writing and editing source code. > Any advice will be very welcomed. I will do my best with The cooperation with engaged developers to make yours product accessible for visually impaired programmer. > I Am advanced user so I AM really ready to constructively help in this problem not only by submitting it,but I will cooperate with you on A solution. > Thank you very much for yours time and help to The visually impaired users of Lazarus. > With The warmest regards. Hello Mr. Chmiel, I have some minor experience working with the visually impaired (usually not complete blindness). Can you describe the operating system you use and how you make use of your screen reader for editing? Most readers will not be familiar with such things. In the interim, you may want to use another editor for your programming. I do this myself occasionally but recognize that the Lazarus editor has better integration with the design workflow. Cheers, R0b0t1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vojtech.cihak at atlas.cz Sat Sep 30 19:20:31 2017 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sat, 30 Sep 2017 19:20:31 +0200 Subject: [Lazarus] =?utf-8?q?Custom_component=3A_cannot_make_Items=3A_TStr?= =?utf-8?q?ings?= In-Reply-To: 000000007d5b0000980c013a505b References: 000000007d5b0000980c013a505b Message-ID: <20170930192031.C826BF7D@atlas.cz> Hi,   you have unusual getter:   function TATTabs.GetItems: TStrings; var   D: TATTabData;   i: integer; begin   Result:= TStringList.Create;   for i:= 0 to TabCount-1 do   begin     D:= GetTabData(i);     if Assigned(D) then       Result.Add(D.TabCaption)     else       Result.Add('?');   end; end;              IMO, when you run app, ATTabs should read Items from *.lfm. But it creates new instance of TStringList instead. New instance is created from existing tabs, therefore it is empty. Even more, you don't Free then TStringList anywhere, there will be many instantioned Results. I'm not sure with solution, maybe you test csLoading somewhere.   V. ______________________________________________________________ > Od: Alexey via Lazarus > Komu: lazarus mailing list > Datum: 30.09.2017 18:42 > Předmět: [Lazarus] Custom component: cannot make Items: TStrings > Hi. I added to ATTabs prop Items: TStrings. It has getter/setter. It has registering in IDE. - in designer, OI can set Items and tabs appear - if i run app, tabs dont appear- ?? - if I restart IDE, app's LFM looses Items- ?? https://github.com/alexey-t/attabs -- Regards, Alexey -- _______________________________________________ Lazarus mailing list Lazarus at lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus -------------- next part -------------- An HTML attachment was scrubbed... URL: From janusz.chmiel at volny.cz Sat Sep 30 19:24:01 2017 From: janusz.chmiel at volny.cz (Mgr. Janusz Chmiel) Date: Sat, 30 Sep 2017 19:24:01 +0200 Subject: [Lazarus] Accessibility enhacement request Lazarus version 1.7 In-Reply-To: References: Message-ID: Good evening. It is good idea. I will rather discuss with you out of mailing list. I Am using NVDA screen reader. This screen reader is very advanced and it support many applications. NVDA support applications which are using UI automation. So many Windows 10 apps are supported with no issues. I Am using Windows 10 X64 bit edition. Standard Home edition. It would be perfect, if editable field and also designer would become screen reader compatible. But I know, how is it complex to retain visual aspect of GUI and making it usable for visually impaired. I know about other editors. Such as Akelpad. But it is also necessary to use form designer for some tasks. Thank you very much for yours interest about accessibility. From juha.manninen62 at gmail.com Sat Sep 30 19:59:34 2017 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sat, 30 Sep 2017 20:59:34 +0300 Subject: [Lazarus] UTF8Tools problem In-Reply-To: <20170930143824.2BE10CC9@atlas.cz> References: <20170930025929.17A34D5B@atlas.cz> <20170930143824.2BE10CC9@atlas.cz> Message-ID: Ok yes, the function name UnicodeToUtf8 is unfortunately used in both FPC's libs and in Lazarus LazUtils package LazUTF8 unit. It will cause confusion also in the future. Juha From aaa5500 at ya.ru Sat Sep 30 20:30:31 2017 From: aaa5500 at ya.ru (Alexey) Date: Sat, 30 Sep 2017 21:30:31 +0300 Subject: [Lazarus] Custom component: cannot make Items: TStrings In-Reply-To: <20170930192031.C826BF7D@atlas.cz> References: <20170930192031.C826BF7D@atlas.cz> Message-ID: On 30.09.2017 20:20, Vojtěch Čihák via Lazarus wrote: > ATTabs should read Items from *.lfm. But it creates new instance of > TStringList instead. New instance is created from existing tabs, > therefore it is empty. I changed getter. it uses now FTabItems (field) and fills it on each GetItems. But it don't help... -- Regards, Alexey From michael at freepascal.org Sat Sep 30 21:44:23 2017 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 30 Sep 2017 21:44:23 +0200 (CEST) Subject: [Lazarus] Custom component: cannot make Items: TStrings In-Reply-To: <02a6c7e9-cba4-6f89-f99d-710b1355b10f@ya.ru> References: <02a6c7e9-cba4-6f89-f99d-710b1355b10f@ya.ru> Message-ID: On Sat, 30 Sep 2017, Alexey via Lazarus wrote: > Hi. I added to ATTabs prop Items: TStrings. It has getter/setter. It has > registering in IDE. > > - in designer, OI can set Items and tabs appear > > - if i run app, tabs dont appear- ?? > > - if I restart IDE, app's LFM looses Items- ?? > > https://github.com/alexey-t/attabs Remove the clear statement in the setter ? It clears FTabItems, which you just assigned. That's pointless. Also, if FTabItems equals AValue, it will clear the AValue. Michael. From aaa5500 at ya.ru Sat Sep 30 21:50:01 2017 From: aaa5500 at ya.ru (Alexey) Date: Sat, 30 Sep 2017 22:50:01 +0300 Subject: [Lazarus] Custom component: cannot make Items: TStrings In-Reply-To: References: <02a6c7e9-cba4-6f89-f99d-710b1355b10f@ya.ru> Message-ID: <272f0c5d-48c1-f031-6acf-eac92b8537f8@ya.ru> On 30.09.2017 22:44, Michael Van Canneyt via Lazarus wrote: > Remove the clear statement in the setter ? > > It clears FTabItems, which you just assigned. That's pointless. > Also, if FTabItems equals AValue, it will clear the AValue hmm, setter don't clear FTabItems, it clear another FTabList [TList]. procedure TATTabs.SetItems(AValue: TStrings); var   i: integer; begin   FTabItems.Assign(AValue);   Clear;   for i:= 0 to AValue.Count-1 do     AddTab(-1, AValue[i]); end; (updated repo) -- Regards, Alexey