From sysrpl at gmail.com Sun Jul 1 16:50:53 2018 From: sysrpl at gmail.com (Anthony Walter) Date: Sun, 1 Jul 2018 10:50:53 -0400 Subject: [Lazarus] Application Idea Request for Comments Message-ID: I am likely going to create a simple program that allows users to create real time effects on using one or more source video files, and am requesting comments before I start. I'd like to know what other cross platform (Mac/Windows/Linux/Pi) programs exists that work as I am going to describe, and am also open to suggestions. Use case scenarios: - Fun video effects to display on a large home theater screen. - Programmable neo pixel effects based on video and or audio sources. - Picture in picture displays with 3D transforms and animation. - Custom detailed audio equalization and visualization. - Easy reverb, echo, delay, flanger, chorus effects. - Any other idea you have to either manipulate video and audio in real time, or forward data from video/audio to other external APIs such as Raspberry Pi GPIO pins. Here are the details of what I am thinking about its operation: - Purely text based input. - Run from the command line with a Javascript file as the main script. - The program creates a full screen video player given input from the script file. - The script file can then alter the video and audio in real time as it plays. It can add effects such as mosiac, posterization, ascii matrix, mirroring/3D transforms, overlay text, color substitution or chroma key, etc. It can also put effect on audio track. - The script can load other script files, and call subroutines. - Your own custom GLSL fragment shaders implement the actual pixel operations. - Multiple video, image, and audio sources can be composited to one final video/audio stream. - The program will include may pre fabricated scripts with reusable subroutines and examples. The details of implementation include: - The MVP video player will be used to decode video files. - The SDL media library will be used to create a window and graphics context and audio mixer. - The MVP API gives access to video frames through an OpenGL frame buffer object. I assume it also has an audio API. - Javascript will come from the JSC webkit engine. - GLSL fragment shaders will be connected to the rendering pipeline by user defined Javascript functions. -------------- next part -------------- An HTML attachment was scrubbed... URL: From M.Santhoff at web.de Tue Jul 3 22:16:26 2018 From: M.Santhoff at web.de (Marc Santhoff) Date: Tue, 03 Jul 2018 22:16:26 +0200 Subject: [Lazarus] Application Idea Request for Comments In-Reply-To: References: Message-ID: <1530648986.4310.1.camel@web.de> On Sun, 2018-07-01 at 10:50 -0400, Anthony Walter via Lazarus wrote: > I'd like to know what other cross > platform (Mac/Windows/Linux/Pi) programs exists that work as I am going to > describe. There are at least: avidemux lives pitivi shotcut kdenlive kino - dead project openshot openmovieeditor blender -- Marc Santhoff From sysrpl at gmail.com Wed Jul 4 11:43:14 2018 From: sysrpl at gmail.com (Anthony Walter) Date: Wed, 4 Jul 2018 05:43:14 -0400 Subject: [Lazarus] Application Idea Request for Comments In-Reply-To: <1530648986.4310.1.camel@web.de> References: <1530648986.4310.1.camel@web.de> Message-ID: Marc, You linked a bunch programs that can be used as video editors. I am looking for a program that creates effects in real time. You do know the difference right? -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Thu Jul 5 15:50:23 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 5 Jul 2018 15:50:23 +0200 (CEST) Subject: [Lazarus] Searchable docs online Message-ID: Hello, Given the questions of late, I have created a search page for the docs: https://www.freepascal.org/docsearch/docsearch.html This will search in the manuals, and in the reference documentation for the units. There is ample room for improvement, but the page already works. Things to improve: - Allow 'contains' - Allow 'minimum rank' (rank is the number of times a word appears in a page) - Allow to specify in which manual you want to search. - Integrate searching in the doc pages themselves. The underlying mechanisms for this search are 100% FPC based: fpindexer, fcl-web, and the webpage logic is done using pas2js. (meaning you need to have Javascript enabled) Feedback and comments welcome. Michael. From maaartinus at gmail.com Thu Jul 5 16:35:25 2018 From: maaartinus at gmail.com (Martin Grajcar) Date: Thu, 5 Jul 2018 16:35:25 +0200 Subject: [Lazarus] Get an old version running Message-ID: I need to get an old version of Lazarus (like 1.4.2) running. I do have 1.8.2 working, so I though, I just checkout the old one and recompile. Then I ran into the problem described in http://lists.lazarus.freepascal.org/pipermail/lazarus/2015-June/093026.html. I don't think, I can ever understand why, and I'd gladly apply the recommendation Why can't you copy the components/debuggerintf to your build environment? but what is my build environment? It's MacOS, Lazarus installs in /Developer/lazarus and that's where I tried to compile. There's /Developer/lazarus/components/debuggerintf there. What else do I need? -------------- next part -------------- An HTML attachment was scrubbed... URL: From md at delfire.net Thu Jul 5 18:59:14 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 5 Jul 2018 13:59:14 -0300 Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, Jul 5, 2018 at 10:50 AM, Michael Van Canneyt via Lazarus wrote: > > > Feedback and comments welcome. There is no `action` in the search form. Nothing happens... Regards, Marcos Douglas From michael at freepascal.org Thu Jul 5 19:47:44 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 5 Jul 2018 19:47:44 +0200 (CEST) Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, 5 Jul 2018, Marcos Douglas B. Santos via Lazarus wrote: > On Thu, Jul 5, 2018 at 10:50 AM, Michael Van Canneyt via Lazarus > wrote: >> >> >> Feedback and comments welcome. > > There is no `action` in the search form. Nothing happens... Of course there is no action. The Javascript catches the 'OnClick' and executes the request in the background. Michael. From vojtech.cihak at atlas.cz Thu Jul 5 19:49:21 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Thu, 05 Jul 2018 19:49:21 +0200 Subject: [Lazarus] =?utf-8?q?Searchable_docs_online?= In-Reply-To: 000000008df60001e5a8017f509a References: 000000008df60001e5a8017f509a Message-ID: <20180705194921.878988F3@atlas.cz> Hi,   what is your browser? I use Falkon, here works both button and enter-key.   V. ______________________________________________________________ > Od: "Marcos Douglas B. Santos via Lazarus" > Komu: Lazarus mailing list > Datum: 05.07.2018 18:59 > Předmět: Re: [Lazarus] Searchable docs online > On Thu, Jul 5, 2018 at 10:50 AM, Michael Van Canneyt via Lazarus wrote: > > > Feedback and comments welcome. There is no `action` in the search form. Nothing happens... 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 md at delfire.net Thu Jul 5 20:28:39 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 5 Jul 2018 15:28:39 -0300 Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, Jul 5, 2018 at 2:47 PM, Michael Van Canneyt via Lazarus wrote: > > > On Thu, 5 Jul 2018, Marcos Douglas B. Santos via Lazarus wrote: > >> On Thu, Jul 5, 2018 at 10:50 AM, Michael Van Canneyt via Lazarus >> wrote: >>> >>> >>> >>> Feedback and comments welcome. >> >> >> There is no `action` in the search form. Nothing happens... > > > Of course there is no action. The Javascript catches the 'OnClick' and > executes the request in the > background. I know that... but was not working. I've tried a few times and nothing happened. Now, it works. Regards, Marcos Douglas From michael at freepascal.org Thu Jul 5 20:33:19 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 5 Jul 2018 20:33:19 +0200 (CEST) Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, 5 Jul 2018, Marcos Douglas B. Santos via Lazarus wrote: > On Thu, Jul 5, 2018 at 2:47 PM, Michael Van Canneyt via Lazarus > wrote: >> >> >> On Thu, 5 Jul 2018, Marcos Douglas B. Santos via Lazarus wrote: >> >>> On Thu, Jul 5, 2018 at 10:50 AM, Michael Van Canneyt via Lazarus >>> wrote: >>>> >>>> >>>> >>>> Feedback and comments welcome. >>> >>> >>> There is no `action` in the search form. Nothing happens... >> >> >> Of course there is no action. The Javascript catches the 'OnClick' and >> executes the request in the >> background. > > I know that... but was not working. I've tried a few times and nothing happened. > Now, it works. I will add some feedback if there are no results. Michael. From ryan at thealchemistguild.com Thu Jul 5 23:31:59 2018 From: ryan at thealchemistguild.com (Ryan Joseph) Date: Thu, 5 Jul 2018 15:31:59 -0600 Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: > On Jul 5, 2018, at 7:50 AM, Michael Van Canneyt via Lazarus wrote: > > https://www.freepascal.org/docsearch/docsearch.html Great start, I would have used it this morning if I knew it was here. 1) where is the source? I’ve never seen a FPC CGI program and I’m curious/willing to contribute. 2) The sorting isn’t what I’d expect. For example search for “TFPGObjectList” and I would expect to see the class reference as the top result (tfpgobjectlist.html) but instead it’s lower down and preceded by methods. Can this be fixed? Regards, Ryan Joseph From michael at freepascal.org Thu Jul 5 23:51:56 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 5 Jul 2018 23:51:56 +0200 (CEST) Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, 5 Jul 2018, Ryan Joseph via Lazarus wrote: > > >> On Jul 5, 2018, at 7:50 AM, Michael Van Canneyt via Lazarus wrote: >> >> https://www.freepascal.org/docsearch/docsearch.html > > Great start, I would have used it this morning if I knew it was here. > > 1) where is the source? I’ve never seen a FPC CGI program and I’m curious/willing to contribute. I will commit it tomorrow and post the location. > > 2) The sorting isn’t what I’d expect. For example search for “TFPGObjectList” and I would expect to see the class reference as the top result (tfpgobjectlist.html) but instead it’s lower down and preceded by methods. Can this be fixed? As said, the ranking is based on the number of occurrences of the word in a page. The search engine has no semantic knowledge of the structure of the documentation, it is a simple text search engine. But conceivably, other mechanisms can be added to change the ranking. Mihcael. From sysrpl at gmail.com Fri Jul 6 02:54:27 2018 From: sysrpl at gmail.com (Anthony Walter) Date: Thu, 5 Jul 2018 20:54:27 -0400 Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: Michael, Thanks for you work. You might want to refer to my doc site after I finish tiling and painting my server room. https://docs.getlazarus.org It implements pretty much the same thing with a few differences: - Search is incremental with a drop down list that populates as you type (XMLHttpRequest). - Search rank is adjusted by most frequent clicks, with more clicks ranking higher. - Properties, methods, and events link two ways to a side panel, rather than a floating window. - RTL, FCL, and LCL packages can be selected from a drop down list. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Jul 6 07:44:58 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 6 Jul 2018 07:44:58 +0200 (CEST) Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Thu, 5 Jul 2018, Anthony Walter via Lazarus wrote: > Michael, > > Thanks for you work. You might want to refer to my doc site after I finish > tiling and painting my server room. > > https://docs.getlazarus.org > > It implements pretty much the same thing with a few differences: I assume this is all implemented in Pascal ? It would be better if you made available the technology that underpins all that. Michael.. From sysrpl at gmail.com Fri Jul 6 11:45:41 2018 From: sysrpl at gmail.com (Anthony Walter) Date: Fri, 6 Jul 2018 05:45:41 -0400 Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: Michael, It's mostly Typescript, and the source is on the page (F12 developer tools, source map is automatically linked). The Typescript detects key presses, resets a short timeout, invokes XMLHttpRequest, and rebuilds the drop down using a template. The server part that response to XMLHttpRequest is based on a simple IHttpHandler HandleRequest method that just responds with the same HTML you are using. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Fri Jul 6 11:58:32 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 6 Jul 2018 11:58:32 +0200 (CEST) Subject: [Lazarus] Searchable docs online In-Reply-To: References: Message-ID: On Fri, 6 Jul 2018, Anthony Walter wrote: > Michael, > > It's mostly Typescript, and the source is on the page (F12 developer tools, > source map is automatically linked). The Typescript detects key presses, > resets a short timeout, invokes XMLHttpRequest, and rebuilds the drop down > using a template. The server part that response to XMLHttpRequest is based > on a simple IHttpHandler HandleRequest method that just responds with the > same HTML you are using. Typescript on a page about lazarus ? pas2js is the way to go these days ;-) I was not talking about the autocomplete, this is easily handled. I will add that later on, after all it's just a first version what I put online... I'm more interested in the underlying docs structure. I've been thinking about adding an option to fpdoc to create a HTML version using frames, it would save me some work if I could reuse the work you did. Well, never mind. Michael. (BTW your server is not responding currently) From markMLl.lazarus at telemetry.co.uk Sat Jul 7 11:46:35 2018 From: markMLl.lazarus at telemetry.co.uk (Mark Morgan Lloyd) Date: Sat, 7 Jul 2018 09:46:35 +0000 Subject: [Lazarus] Debugging Lazarus using Lazarus Message-ID: When multiple copies of the same version (e.g. trunk) Lazarus are being run, with a view to stepping through a problem in IDE-related code, is there any way to force an override so that all windows associated with the "inner" copy are marked distinctively with e.g. an implausible background colour, a thin diagonal line overlaying the content, or at the very least an instance identifier in every caption? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] From lazarus at mfriebe.de Sat Jul 7 12:41:59 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 7 Jul 2018 12:41:59 +0200 Subject: [Lazarus] Debugging Lazarus using Lazarus In-Reply-To: References: Message-ID: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> On 07/07/2018 11:46, Mark Morgan Lloyd via Lazarus wrote: > When multiple copies of the same version (e.g. trunk) Lazarus are > being run, with a view to stepping through a problem in IDE-related > code, is there any way to force an override so that all windows > associated with the "inner" copy are marked distinctively with e.g. an > implausible background colour, a thin diagonal line overlaying the > content, or at the very least an instance identifier in every caption? > In menu Run > Run Parameter, specify --primary-config-path=/somefolder - Then on first run, go into options > editor > colors, and change whatever color you like. (e.g. background or gutter). well ok that is only the editor windows. It will not affect breakpoints, etc.... - The main IDE bar has/has not the word "debugging" in it. - You can also have a different projects open. As the last open project will be re-open, and that is stored in primary conf. With that, the debugged IDE will not open the stack and watches window (unless you want it to). From markMLl.lazarus at telemetry.co.uk Sat Jul 7 13:09:39 2018 From: markMLl.lazarus at telemetry.co.uk (Mark Morgan Lloyd) Date: Sat, 7 Jul 2018 11:09:39 +0000 Subject: [Lazarus] Debugging Lazarus using Lazarus In-Reply-To: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> References: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> Message-ID: On 07/07/18 10:45, Martin Frb via Lazarus wrote: > On 07/07/2018 11:46, Mark Morgan Lloyd via Lazarus wrote:> When multiple > copies of the same version (e.g. trunk) Lazarus are > being run, with a > view to stepping through a problem in IDE-related > code, is there any > way to force an override so that all windows > associated with the > "inner" copy are marked distinctively with e.g. an > implausible > background colour, a thin diagonal line overlaying the > content, or at > the very least an instance identifier in every caption?>In menu Run > > Run Parameter, specify --primary-config-path=/somefolder > - Then on first run, go into options > editor > colors, and change > whatever color you like. (e.g. background or gutter). well ok that is > only the editor windows. It will not affect breakpoints, etc....- The > main IDE bar has/has not the word "debugging" in it.- You can also have > a different projects open. As the last open project will be re-open, and > that is stored in primary conf. With that, the debugged IDE will not > open the stack and watches window (unless you want it to). I've got /two/ main editor bars with "debugging" in them, two windws called "Source Editor (2)" and so on :-) I'd have thought that a comparatively easy way round this would have been a global option to put the main-process PID on all form/dialogue captions. That would have result in a useful distinction even when multiple instances were using the same configuration files. But I'm not volunteering to do it this weekend ;-) -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] From lazarus at mfriebe.de Sat Jul 7 13:39:33 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 7 Jul 2018 13:39:33 +0200 Subject: [Lazarus] Debugging Lazarus using Lazarus In-Reply-To: References: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> Message-ID: On 07/07/2018 13:09, Mark Morgan Lloyd via Lazarus wrote: > On 07/07/18 10:45, Martin Frb via Lazarus wrote: >> On 07/07/2018 11:46, Mark Morgan Lloyd via Lazarus wrote:> When >> multiple copies of the same version (e.g. trunk) Lazarus are > being >> run, with a view to stepping through a problem in IDE-related > code, >> is there any way to force an override so that all windows > >> associated with the "inner" copy are marked distinctively with e.g. >> an > implausible background colour, a thin diagonal line overlaying >> the > content, or at the very least an instance identifier in every >> caption?>In menu Run > Run Parameter, specify >> --primary-config-path=/somefolder >> - Then on first run, go into options > editor > colors, and change >> whatever color you like. (e.g. background or gutter). well ok that is >> only the editor windows. It will not affect breakpoints, etc....- The >> main IDE bar has/has not the word "debugging" in it.- You can also >> have a different projects open. As the last open project will be >> re-open, and that is stored in primary conf. With that, the debugged >> IDE will not open the stack and watches window (unless you want it to). > > I've got /two/ main editor bars with "debugging" in them, two windws > called "Source Editor (2)" and so on :-) But unless the inner IDE (the one being debugged) is itself debugging a third IDE, you can use the current project name. Tools > Options > Window: CheckBox "IDE title shows starts with project name" (and related options) In fact, I think the project name is always show (just usually at the end) And with separate primary conf, the debugged IDE loads a project of your choice But if you need to have the IDE as 3rd debuggee, then modify/hide the component palette. > > I'd have thought that a comparatively easy way round this would have > been a global option to put the main-process PID on all form/dialogue > captions. That would have result in a useful distinction even when > multiple instances were using the same configuration files. Do they need the same config? But your idea with the PID, just hack TForm.SetCaption (or SetRealText) From lazarus at mfriebe.de Sat Jul 7 13:42:55 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sat, 7 Jul 2018 13:42:55 +0200 Subject: [Lazarus] Debugging Lazarus using Lazarus In-Reply-To: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> References: <1489d2fd-6219-b430-6be1-d071268b1d68@mfriebe.de> Message-ID: <51daf80a-9718-342c-9940-4189750841ff@mfriebe.de> On 07/07/2018 12:41, Martin Frb via Lazarus wrote: > In menu Run > Run Parameter, specify --primary-config-path=/somefolder Another big benefit: You can move the windows of the debugged IDE to a different location, and that will be saved. So from then on, when you start debugging the IDE, the windows will not overlap/clash with the outer IDE. (and the position also helps identifying which is which) I am doing exactly this myself, right now. From md at delfire.net Sun Jul 8 04:52:20 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Sat, 7 Jul 2018 23:52:20 -0300 Subject: [Lazarus] Different paths, different computers, and one project Message-ID: Imagine a project that works only with set of unit paths (-Fu), not packages. The issue is that a computer could have a different path for a lib, comparing to another one. I've removed the paths from the project (.lpi) and added an `@extrafpc.cfg` with `-Fu` and `-Fl` paths. I can compile the project, but the code-completion doesn't work because the IDE can't find the units. I can't also use `Other sources` option cause it will have the same problem using `-Fu` and hard-coded paths. How to configure the paths? Regards, Marcos Douglas From md at delfire.net Sun Jul 8 05:58:57 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Sun, 8 Jul 2018 00:58:57 -0300 Subject: [Lazarus] Different paths, different computers, and one project In-Reply-To: References: Message-ID: On Sat, Jul 7, 2018 at 11:52 PM, Marcos Douglas B. Santos wrote: > Imagine a project that works only with set of unit paths (-Fu), not packages. > The issue is that a computer could have a different path for a lib, > comparing to another one. > > I've removed the paths from the project (.lpi) and added an > `@extrafpc.cfg` with `-Fu` and `-Fl` paths. I can compile the project, > but the code-completion doesn't work because the IDE can't find the > units. > I can't also use `Other sources` option cause it will have the same > problem using `-Fu` and hard-coded paths. > > How to configure the paths? I've used the $Env(name) and it worked. The $Env is the best option in that case? From michael at freepascal.org Sun Jul 8 21:07:15 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 8 Jul 2018 21:07:15 +0200 (CEST) Subject: [Lazarus] [fpc-pascal] Searchable docs online In-Reply-To: References: <9cb7b8f6-9ebd-cef2-74e0-20abd32117ca@kampherbeek.com> Message-ID: On Sun, 8 Jul 2018, Ryan Joseph wrote: > Just tried to use https://www.freepascal.org/docsearch/docsearch.html and it seems to have a bug (not working, errors in the JS console). Awaiting the source on svn also. :) Possibly, I have been doing some experiments. I have re-enabled it. It is now also referred to from the main docs page: https://www.freepascal.org/docs.var The search term edit box now has type-ahead enabled. Sources (webpage/server) can be found on: https://svn.freepascal.org/svn/html/docsearch/ The server needs the latest fpindexer: https://svn.freepascal.org/svn/fpc/trunk/packages/fpindexer/ The indexer works using postgres, but sqlite, firebird (in fact any SQLDB DB) are also supported. There is also support for a custom file format. The "client" is written in pas2js. So it comprises now a full-fledged example of how FPC can be used as a full-stack web development environment. In a couple of moments, I will commit a more general version of the HTML searchengine under fpindexer examples. Michael. From michael at freepascal.org Mon Jul 9 13:37:51 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Mon, 9 Jul 2018 13:37:51 +0200 (CEST) Subject: [Lazarus] synedit markdown highlighter ? Message-ID: Hi, Is there a markdown highlighter for synedit available ? Michael. From leledumbo_cool at yahoo.co.id Mon Jul 9 19:57:03 2018 From: leledumbo_cool at yahoo.co.id (leledumbo) Date: Mon, 9 Jul 2018 10:57:03 -0700 (MST) Subject: [Lazarus] synedit markdown highlighter ? In-Reply-To: References: Message-ID: <1531159023964-0.post@n3.nabble.com> > Is there a markdown highlighter for synedit available ? Nope, not even the original SynEdit project has it (there are at least 2 issues requesting it, one has an idea to make one based on HTML highlighter, but no real implementation yet). Same question was asked a couple of months ago in forum, was that you? It might be easy to write one, markdown is rather simple. The HTML highlighter can be used as a fallback if none of the current token + context matches any markdown construct. -- Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/ From lazarus at mfriebe.de Mon Jul 9 20:37:50 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Mon, 9 Jul 2018 20:37:50 +0200 Subject: [Lazarus] synedit markdown highlighter ? In-Reply-To: <1531159023964-0.post@n3.nabble.com> References: <1531159023964-0.post@n3.nabble.com> Message-ID: On 09/07/2018 19:57, leledumbo via Lazarus wrote: > It might be easy to write one, markdown is > rather simple. There is a tutorial how to write a HL http://wiki.lazarus.freepascal.org/SynEdit_Highlighter From fjf.vanleeuwen at quicknet.nl Thu Jul 12 12:51:46 2018 From: fjf.vanleeuwen at quicknet.nl (frans) Date: Thu, 12 Jul 2018 12:51:46 +0200 Subject: [Lazarus] LCL_FULLVERSION is not recognized Message-ID: <14fd8a57-950d-5d37-1703-b44bcc6abebd@quicknet.nl> Hi. I use Lazarus 1.6.4 (temporarely) and lazarus 1.8.4 on Windows 10. I need to use the LCL version but I can't get it to work properly. I use the following code:   {$IFDEF LCL_FULLVERSION > 1080000}   {$ELSE}   {$ENDIF} Compiling the program give me the message Warning include environment "LCL_FULLVERSION" not found in environment. But this is the way I fount on the lazarus forum. What am I doing wrong? And where can I find a list of all Lazarus environment variables? -- mvg Frans van Leeuwen M 06-51695390 --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com From rik at graficalc.nl Thu Jul 12 13:43:45 2018 From: rik at graficalc.nl (Rik van Kekem) Date: Thu, 12 Jul 2018 13:43:45 +0200 Subject: [Lazarus] LCL_FULLVERSION is not recognized In-Reply-To: <14fd8a57-950d-5d37-1703-b44bcc6abebd@quicknet.nl> References: <14fd8a57-950d-5d37-1703-b44bcc6abebd@quicknet.nl> Message-ID: <28465f77-3135-bdc6-b058-4e06399ae5ca@graficalc.nl> On 12-07-2018 12:51, frans via Lazarus wrote: > I use Lazarus 1.6.4 (temporarely) and lazarus 1.8.4 on Windows 10. > I need to use the LCL version but I can't get it to work properly. > I use the following code: >   {$IFDEF LCL_FULLVERSION > 1080000} >   {$ELSE} >   {$ENDIF} > Compiling the program give me the message Warning include environment > "LCL_FULLVERSION" not found in environment. But this is the way I > fount on the lazarus forum. > What am I doing wrong? And where can I find a list of all Lazarus > environment variables? > Where did you find this on the forum? Because you shouldn't use {$IFDEF } but {$IF } (because you are using an expression) So: {$IF LCL_FULLVERSION > 1080000} {$ELSE} {$ENDIF} If you use {$IFDEF it will check if "LCL_FULLVERSION > 1080000" is defined, which it isn't. Also see http://www.math.uni-leipzig.de/pool/tuts/FreePascal/prog/node4.html B.T.W. You need to include "uses lclversion" because LCL_FULLVERSION is declared there (otherwise you get a ansistring error message). Some other constants: http://lazarus-ccr.sourceforge.net/docs/lcl/lclversion/index-2.html Grtz, Rik -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Thu Jul 12 14:19:14 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 12 Jul 2018 14:19:14 +0200 (CEST) Subject: [Lazarus] IDE option: Convert selection to string ? Message-ID: Hello, The IDE contains a 'make resource string' refactoring option. This requires the selection to be a pascal string. However, I quite often find myself in the need to create a string constant from arbitrary text: I test an SQL statement in an SQL tool, and then I copy it to the pascal source file where I need it. I must then manually convert it to a string constant by adding the necessary quotes, doubling single quotes already there and appending +sLineBreak+ etc. It would be nice if the IDE could do this: select a block of text, and choose 'Refactoring -> convert to pascal string' Currently I have a separate tool that does this (both ways: quote and unquote, in case I need to re-rest an SQL statement from my code) but it would be a lot faster if the IDE could do it for me. Most likely it already contains code that does similar things like this. I cannot imagine I am the only one with this need :) Any chance of getting such a feature ? Michael. From md at delfire.net Thu Jul 12 14:35:48 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Thu, 12 Jul 2018 09:35:48 -0300 Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: References: Message-ID: On Thu, Jul 12, 2018 at 9:19 AM, Michael Van Canneyt via Lazarus wrote: > > I cannot imagine I am the only one with this need :) +1 Of course you're not alone! Marcos Douglas From sysrpl at gmail.com Thu Jul 12 14:36:02 2018 From: sysrpl at gmail.com (Anthony Walter) Date: Thu, 12 Jul 2018 08:36:02 -0400 Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: References: Message-ID: How about something that takes the current caret position in the source editor, the clipboard context, and inserts as a Pascal quoted string that wraps with + at the end of line, and appropriate system defined line break characters? The command for this would be in the menu as "Edit -> Paste as String", and reassignable through custom keyboard bindings. This would be easy enough to add, but for me unfortunately I've been busy with moving and renovating my house. When I'm done if no one else has added it, I might write it as an add on package. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Thu Jul 12 14:53:22 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 12 Jul 2018 14:53:22 +0200 (CEST) Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: References: Message-ID: On Thu, 12 Jul 2018, Anthony Walter via Lazarus wrote: > How about something that takes the current caret position in the source > editor, the clipboard context, and inserts as a Pascal quoted string that > wraps with + at the end of line, and appropriate system defined line break > characters? > > The command for this would be in the menu as "Edit -> Paste as String", and > reassignable through custom keyboard bindings. > > This would be easy enough to add, but for me unfortunately I've been busy > with moving and renovating my house. When I'm done if no one else has added > it, I might write it as an add on package. I think both options should be available. Sometimes the clipboard contains 'too much' and I want to limit the selection. The underlying mechanism is of course the same. Michael. From fjf.vanleeuwen at quicknet.nl Thu Jul 12 15:24:49 2018 From: fjf.vanleeuwen at quicknet.nl (frans) Date: Thu, 12 Jul 2018 15:24:49 +0200 Subject: [Lazarus] LCL_FULLVERSION is not recognized In-Reply-To: <28465f77-3135-bdc6-b058-4e06399ae5ca@graficalc.nl> References: <14fd8a57-950d-5d37-1703-b44bcc6abebd@quicknet.nl> <28465f77-3135-bdc6-b058-4e06399ae5ca@graficalc.nl> Message-ID: <2cd10022-9d91-ef33-451a-621c5553d413@quicknet.nl> It works, Thx mvg Frans van Leeuwen M 06-51695390 Op 12-7-2018 om 13:43 schreef Rik van Kekem via Lazarus: > On 12-07-2018 12:51, frans via Lazarus wrote: >> I use Lazarus 1.6.4 (temporarely) and lazarus 1.8.4 on Windows 10. >> I need to use the LCL version but I can't get it to work properly. >> I use the following code: >>   {$IFDEF LCL_FULLVERSION > 1080000} >>   {$ELSE} >>   {$ENDIF} >> Compiling the program give me the message Warning include environment >> "LCL_FULLVERSION" not found in environment. But this is the way I >> fount on the lazarus forum. >> What am I doing wrong? And where can I find a list of all Lazarus >> environment variables? >> > Where did you find this on the forum? > Because you shouldn't use {$IFDEF } but {$IF } (because you are using > an expression) > > So: > {$IF LCL_FULLVERSION > 1080000} > {$ELSE} > {$ENDIF} > > If you use {$IFDEF it will check if "LCL_FULLVERSION > 1080000" is > defined, which it isn't. > > Also see > http://www.math.uni-leipzig.de/pool/tuts/FreePascal/prog/node4.html > > B.T.W. You need to include "uses lclversion" because LCL_FULLVERSION > is declared there (otherwise you get a ansistring error message). > > Some other constants: > http://lazarus-ccr.sourceforge.net/docs/lcl/lclversion/index-2.html > > Grtz, > Rik > > > --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at mfriebe.de Thu Jul 12 16:52:58 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Thu, 12 Jul 2018 16:52:58 +0200 Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: References: Message-ID: <25e28ba2-6b24-7389-f2c2-6ea3e2b73945@mfriebe.de> On 12/07/2018 14:36, Anthony Walter via Lazarus wrote: > How about something that takes the current caret position in the > source editor, the clipboard context, and inserts as a Pascal quoted > string that wraps with + at the end of line, and appropriate system > defined line break characters? > > The command for this would be in the menu as "Edit -> Paste as > String", and reassignable through custom keyboard bindings. > > This would be easy enough to add, but for me unfortunately I've been > busy with moving and renovating my house. When I'm done if no one else > has added it, I might write it as an add on package. > For this, have a look ot menu Edit > Multi line paste From michael at freepascal.org Thu Jul 12 17:00:46 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Thu, 12 Jul 2018 17:00:46 +0200 (CEST) Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: <25e28ba2-6b24-7389-f2c2-6ea3e2b73945@mfriebe.de> References: <25e28ba2-6b24-7389-f2c2-6ea3e2b73945@mfriebe.de> Message-ID: On Thu, 12 Jul 2018, Martin Frb via Lazarus wrote: > On 12/07/2018 14:36, Anthony Walter via Lazarus wrote: >> How about something that takes the current caret position in the >> source editor, the clipboard context, and inserts as a Pascal quoted >> string that wraps with + at the end of line, and appropriate system >> defined line break characters? >> >> The command for this would be in the menu as "Edit -> Paste as >> String", and reassignable through custom keyboard bindings. >> >> This would be easy enough to add, but for me unfortunately I've been >> busy with moving and renovating my house. When I'm done if no one else >> has added it, I might write it as an add on package. >> > For this, have a look ot menu Edit > Multi line paste 'Multipaste' Very nice, these hidden gems... :) Michael. From lazarus at mfriebe.de Thu Jul 12 17:06:14 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Thu, 12 Jul 2018 17:06:14 +0200 Subject: [Lazarus] IDE option: Convert selection to string ? In-Reply-To: References: Message-ID: On 12/07/2018 14:19, Michael Van Canneyt via Lazarus wrote: > > It would be nice if the IDE could do this: > select a block of text, and choose 'Refactoring -> convert to pascal > string' > > Currently I have a separate tool that does this (both ways: quote and > unquote, in case I need to re-rest an SQL statement from my code) but > it would be a lot faster if the IDE could do it for me. Most likely it > already contains code > that does similar things like this. While it would be nice as a build in, you can always add it as pascal script macro. From vojtech.cihak at atlas.cz Fri Jul 13 16:01:51 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Fri, 13 Jul 2018 16:01:51 +0200 Subject: [Lazarus] =?utf-8?q?fpdebug_question?= Message-ID: <20180713160151.8C7F0E3F@atlas.cz> Hi, when I write following code (to force SIGSEGV)   unit Unit1; {$mode objfpc}{$H+}   interface   uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;   type   { TForm1 }   TForm1 = class(TForm)     Button1: TButton;     procedure Button1Click(Sender: TObject);   private     public     end;   var   Form1: TForm1;   implementation   {$R *.lfm}   { TForm1 }   procedure TForm1.Button1Click(Sender: TObject); var a: array of Double; begin   a[99]:=3.14; end;   end.         with GDB: I got exception message box, then I got grayed line in Source Editor etc.   with fpdebug: also exception message box, when I click OK then Lazarus Main window dissapears, Access Violation, and I have to restart whole IDE.   Is it known issue? After all fpdebug is still marked "beta".   PS: Good thing about fpdebug is lower memory footprint.   fpdebug: process lazarus 137MB   gdb: process lazarus and gdb 86MB + 184MB = 270MB   Thanks, Vojtěch -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at mfriebe.de Fri Jul 13 17:20:19 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Fri, 13 Jul 2018 17:20:19 +0200 Subject: [Lazarus] fpdebug question In-Reply-To: <20180713160151.8C7F0E3F@atlas.cz> References: <20180713160151.8C7F0E3F@atlas.cz> Message-ID: <71d84ad2-53bd-340e-a4fb-6f190418809e@mfriebe.de> On 13/07/2018 16:01, Vojtěch Čihák via Lazarus wrote: > > Hi, > > when I write following code (to force SIGSEGV) > ... > > with fpdebug: also exception message box, when I click OK then Lazarus > Main window dissapears, Access Violation, and I have to restart whole IDE. > > Is it known issue? After all fpdebug is still marked "beta". > It was not. It has been, since your mail. It no longer is. (That is, it should be fixed in svn now) -------------- next part -------------- An HTML attachment was scrubbed... URL: From vojtech.cihak at atlas.cz Fri Jul 13 17:36:20 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Fri, 13 Jul 2018 17:36:20 +0200 Subject: [Lazarus] =?utf-8?q?fpdebug_question?= In-Reply-To: 000000008e3500017d3001814ffe References: <20180713160151.8C7F0E3F@atlas.cz> 000000008e3500017d3001814ffe Message-ID: <20180713173620.C963B180@atlas.cz> Thank you very much! :-) ______________________________________________________________ > Od: Martin Frb via Lazarus > Komu: lazarus at lists.lazarus-ide.org > Datum: 13.07.2018 17:20 > Předmět: Re: [Lazarus] fpdebug question > On 13/07/2018 16:01, Vojtěch Čihák via Lazarus wrote:Hi, when I write following code (to force SIGSEGV) ...  with fpdebug: also exception message box, when I click OK then Lazarus Main window dissapears, Access Violation, and I have to restart whole IDE.   Is it known issue? After all fpdebug is still marked "beta". It was not. It has been, since your mail. It no longer is. (That is, it should be fixed in svn now) ---------- -- _______________________________________________ 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 Jul 14 00:04:58 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Sat, 14 Jul 2018 01:04:58 +0300 Subject: [Lazarus] Cosmetically fix HeaderSrc const Message-ID: IMO such const will be nicer to read in package files. so I fixed it. before it was like { ddddddddddddddd    ddddddddddddddd } Now it's like // dddddddddddddd // dddddddddddddd -- Regards, Alexey -------------- next part -------------- A non-text attachment was scrubbed... Name: cn.diff Type: text/x-patch Size: 862 bytes Desc: not available URL: From michael at freepascal.org Sat Jul 14 09:51:01 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 14 Jul 2018 09:51:01 +0200 (CEST) Subject: [Lazarus] Cosmetically fix HeaderSrc const In-Reply-To: References: Message-ID: On Sat, 14 Jul 2018, AlexeyT via Lazarus wrote: > IMO such const will be nicer to read in package files. so I fixed it. before > it was like > > { ddddddddddddddd > >    ddddddddddddddd > > } > > Now it's like > > // dddddddddddddd > > // dddddddddddddd Actually, I prefer the { } way. Michael. From michael at freepascal.org Sun Jul 15 10:36:06 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 15 Jul 2018 10:36:06 +0200 (CEST) Subject: [Lazarus] Copy to clipboard from synedit Message-ID: Hi, If you copy text to the clipboard in synedit, an extra #0 character is copied at the end. It does not happen for other controls I tested. I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other platforms/widgetsets. This can be seen easily: copy some source text in the IDE. Paste it in libreoffice writer. You'll get a # character at the end. Some programs handle it well (xclip), some do not. I've also had problems copying text e.g. to a browser. I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other platforms/widgetsets. Michael. From nc-gaertnma at netcologne.de Sun Jul 15 11:18:14 2018 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Sun, 15 Jul 2018 11:18:14 +0200 Subject: [Lazarus] Copy to clipboard from synedit In-Reply-To: References: Message-ID: <20180715111814.258ca823@limapholos.matflo.wg> On Sun, 15 Jul 2018 10:36:06 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: > Hi, > > If you copy text to the clipboard in synedit, an extra #0 character is > copied at the end. It does not happen for other controls I tested. > > I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other > platforms/widgetsets. > > This can be seen easily: copy some source text in the IDE. Paste it in > libreoffice writer. You'll get a # character at the end. > > Some programs handle it well (xclip), some do not. > I've also had problems copying text e.g. to a browser. > > I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other > platforms/widgetsets. A regression probably caused by this: https://bugs.freepascal.org/view.php?id=21453 Mattias From michael at freepascal.org Sun Jul 15 12:07:28 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 15 Jul 2018 12:07:28 +0200 (CEST) Subject: [Lazarus] Copy to clipboard from synedit In-Reply-To: <20180715111814.258ca823@limapholos.matflo.wg> References: <20180715111814.258ca823@limapholos.matflo.wg> Message-ID: On Sun, 15 Jul 2018, Mattias Gaertner via Lazarus wrote: > On Sun, 15 Jul 2018 10:36:06 +0200 (CEST) > Michael Van Canneyt via Lazarus wrote: > >> Hi, >> >> If you copy text to the clipboard in synedit, an extra #0 character is >> copied at the end. It does not happen for other controls I tested. >> >> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other >> platforms/widgetsets. >> >> This can be seen easily: copy some source text in the IDE. Paste it in >> libreoffice writer. You'll get a # character at the end. >> >> Some programs handle it well (xclip), some do not. >> I've also had problems copying text e.g. to a browser. >> >> I tested on Linux, 64-bit GTK2, but I suppose it will be the same for other >> platforms/widgetsets. > > A regression probably caused by this: > https://bugs.freepascal.org/view.php?id=21453 It seems a fix is available but needs to be enabled using a define ? Michael. From lazarus at mfriebe.de Sun Jul 15 12:27:48 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 15 Jul 2018 12:27:48 +0200 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: References: <20180715111814.258ca823@limapholos.matflo.wg> Message-ID: On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote: > > > It seems a fix is available but needs to be enabled using a define ? Please try with rev 58530 To be tested: - Copy one word from synedit  to  synedit - Copy one word from synedit  to  TEdit or TMemo - Copy one word from synedit  to  libre office (or other external app) All of the above with multiline / full line All of the above in reverse All of the above with "column mode selection" Fold a begin/end (or any other) block in synedit. Copy a selection containing the entire folded block. Paste it in SynEdit => the pasted text should have the block folded (assuming you did not disable this in options) ===================== The old patch had a problem: It removed the #0 from any clipboard data. Including Text, images, custom. But the LCL only added the extra to text (and only if added via "AsText") So any data added any other way, if it had a #0 (that was part of the data) would be mangled. SynEdit adds custom data (to preserve folds). From lazarus at mfriebe.de Sun Jul 15 12:29:57 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 15 Jul 2018 12:29:57 +0200 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: References: <20180715111814.258ca823@limapholos.matflo.wg> Message-ID: <2c32e861-7f6c-3465-c085-07a9c53aaeb7@mfriebe.de> Those tests should be done WITHOUT GTK_REMOVE_CLIPBOARD_NULL defined. On 15/07/2018 12:27, Martin Frb via Lazarus wrote: > On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote: >> >> >> It seems a fix is available but needs to be enabled using a define ? > > Please try with rev 58530 > > To be tested: > > - Copy one word from synedit  to  synedit > - Copy one word from synedit  to  TEdit or TMemo > - Copy one word from synedit  to  libre office (or other external app) > > > All of the above with multiline / full line > All of the above in reverse > All of the above with "column mode selection" > > Fold a begin/end (or any other) block in synedit. > Copy a selection containing the entire folded block. > Paste it in SynEdit => the pasted text should have the block folded > (assuming you did not disable this in options) > > ===================== > The old patch had a problem: > > It removed the #0 from any clipboard data. Including Text, images, > custom. > But the LCL only added the extra to text (and only if added via "AsText") > > So any data added any other way, if it had a #0 (that was part of the > data) would be mangled. > SynEdit adds custom data (to preserve folds). > > From michael at freepascal.org Sun Jul 15 12:46:35 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 15 Jul 2018 12:46:35 +0200 (CEST) Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: <2c32e861-7f6c-3465-c085-07a9c53aaeb7@mfriebe.de> References: <20180715111814.258ca823@limapholos.matflo.wg> <2c32e861-7f6c-3465-c085-07a9c53aaeb7@mfriebe.de> Message-ID: Updated. Tested copying word, line, multiline, and reversely selected to edit, memo, libreoffice. All seems well. GTK2, linux, 64-bit. Michael. On Sun, 15 Jul 2018, Martin Frb via Lazarus wrote: > Those tests should be done WITHOUT > GTK_REMOVE_CLIPBOARD_NULL > defined. > > On 15/07/2018 12:27, Martin Frb via Lazarus wrote: >> On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote: >>> >>> >>> It seems a fix is available but needs to be enabled using a define ? >> >> Please try with rev 58530 >> >> To be tested: >> >> - Copy one word from synedit  to  synedit >> - Copy one word from synedit  to  TEdit or TMemo >> - Copy one word from synedit  to  libre office (or other external app) >> >> >> All of the above with multiline / full line >> All of the above in reverse >> All of the above with "column mode selection" >> >> Fold a begin/end (or any other) block in synedit. >> Copy a selection containing the entire folded block. >> Paste it in SynEdit => the pasted text should have the block folded >> (assuming you did not disable this in options) >> >> ===================== >> The old patch had a problem: >> >> It removed the #0 from any clipboard data. Including Text, images, >> custom. >> But the LCL only added the extra to text (and only if added via "AsText") >> >> So any data added any other way, if it had a #0 (that was part of the >> data) would be mangled. >> SynEdit adds custom data (to preserve folds). >> >> > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus > From juha.manninen62 at gmail.com Sun Jul 15 14:04:11 2018 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sun, 15 Jul 2018 15:04:11 +0300 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: References: <20180715111814.258ca823@limapholos.matflo.wg> <2c32e861-7f6c-3465-c085-07a9c53aaeb7@mfriebe.de> Message-ID: Amazing! It is clear when looking at your commit but I did not understand the clipboard issues enough when adding the workaround and GTK_REMOVE_CLIPBOARD_NULL define. I guess the define can be removed at some point. Martin, please do that when all is proven to work. Juha From vojtech.cihak at atlas.cz Sun Jul 15 14:39:30 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sun, 15 Jul 2018 14:39:30 +0200 Subject: [Lazarus] =?utf-8?q?TESTERS_NEEDED_/_ALL_PLATFORMS_/_COPY_AND_PAS?= =?utf-8?q?TE_/_Re=3A_Copy_to_clipboard_from_synedit?= In-Reply-To: 000000008e3e000185680182500c References: , <20180715111814.258ca823@limapholos.matflo.wg>, 000000008e3e000185680182500c Message-ID: <20180715143930.A8BB221F@atlas.cz> Hi,   I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried also with -dDisableUTF8RTL All works well with two exceptions:   1) folded block is copied folded only in implementation section. In interface section become unfolded (for example block TForm1 = class(TForm)...)   2) I don't know what is "Column Mode Selection"   Vojtěch ______________________________________________________________ > Od: Martin Frb via Lazarus > Komu: lazarus at lists.lazarus-ide.org > Datum: 15.07.2018 12:27 > Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: > On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote: > > > It seems a fix is available but needs to be enabled using a define ? -- _______________________________________________ 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 vojtech.cihak at atlas.cz Sun Jul 15 14:39:31 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sun, 15 Jul 2018 14:39:31 +0200 Subject: [Lazarus] =?utf-8?q?TESTERS_NEEDED_/_ALL_PLATFORMS_/_COPY_AND_PAS?= =?utf-8?q?TE_/_Re=3A_Copy_to_clipboard_from_synedit?= In-Reply-To: 000000008e3e000185680182500c References: , <20180715111814.258ca823@limapholos.matflo.wg>, 000000008e3e000185680182500c Message-ID: <20180715143931.1624FC84@atlas.cz> Hi,   I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried also with -dDisableUTF8RTL All works well with two exceptions:   1) folded block is copied folded only in implementation section. In interface section become unfolded (for example block TForm1 = class(TForm)...)   2) I don't know what is "Column Mode Selection"   Vojtěch ______________________________________________________________ > Od: Martin Frb via Lazarus > Komu: lazarus at lists.lazarus-ide.org > Datum: 15.07.2018 12:27 > Předmět: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: > On 15/07/2018 12:07, Michael Van Canneyt via Lazarus wrote: > > > It seems a fix is available but needs to be enabled using a define ? -- _______________________________________________ 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 m-w-vogel at gmx.de Sun Jul 15 14:57:44 2018 From: m-w-vogel at gmx.de (Michael W. Vogel) Date: Sun, 15 Jul 2018 14:57:44 +0200 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: References: <20180715111814.258ca823@limapholos.matflo.wg> Message-ID: Am 15.07.2018 um 12:27 schrieb Martin Frb via Lazarus: > Please try with rev 58530 Tested all your requests on 64bit Windows 7 with 32bit Lazarus and OpenOffice. No problems, work fine here! Michl From juha.manninen62 at gmail.com Sun Jul 15 15:26:09 2018 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Sun, 15 Jul 2018 16:26:09 +0300 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: <20180715143930.A8BB221F@atlas.cz> References: <20180715111814.258ca823@limapholos.matflo.wg> <20180715143930.A8BB221F@atlas.cz> Message-ID: On Sun, Jul 15, 2018 at 3:39 PM Vojtěch Čihák via Lazarus wrote: > 2) I don't know what is "Column Mode Selection" Alt-Shift with arrow keys select a column. Juha From vojtech.cihak at atlas.cz Sun Jul 15 15:34:42 2018 From: vojtech.cihak at atlas.cz (=?utf-8?q?Vojt=C4=9Bch_=C4=8Cih=C3=A1k?=) Date: Sun, 15 Jul 2018 15:34:42 +0200 Subject: [Lazarus] =?utf-8?q?TESTERS_NEEDED_/_ALL_PLATFORMS_/_COPY_AND_PAS?= =?utf-8?q?TE_/_Re=3A_Copy_to_clipboard_from_synedit?= In-Reply-To: 000000008e450001941c01825003 References: , <20180715111814.258ca823@limapholos.matflo.wg>, , <20180715143930.A8BB221F@atlas.cz> 000000008e450001941c01825003 Message-ID: <20180715153442.ECF4CC2C@atlas.cz> Thanks,   column mode works well too.   V. ______________________________________________________________ > Od: Juha Manninen via Lazarus > Komu: Lazarus mailing list > Datum: 15.07.2018 15:26 > Předmět: Re: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: > On Sun, Jul 15, 2018 at 3:39 PM Vojtěch Čihák via Lazarus wrote: > 2) I don't know what is "Column Mode Selection" Alt-Shift with arrow keys select a column. 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 mail at michael-ring.org Sun Jul 15 16:04:22 2018 From: mail at michael-ring.org (Michael Ring) Date: Sun, 15 Jul 2018 16:04:22 +0200 Subject: [Lazarus] Character spacing doubled in R58529 on MacOSX/Cocoa Message-ID: <6d280929-6325-410f-75de-b1a7ee17b96a@michael-ring.org> I today build Lazarus MacOSX/Cocoa**from svn and realized that all characters in the editor seem to have an extra space between each character. I did a little compiling of older SVN's and found out that the problem appeared first in revision 58529. This change in 58529 seems to kill the cat: Index: lcl/interfaces/cocoa/cocoagdiobjects.pas =================================================================== --- lcl/interfaces/cocoa/cocoagdiobjects.pas    (revision 58528) +++ lcl/interfaces/cocoa/cocoagdiobjects.pas    (working copy) @@ -559,6 +559,7 @@    Win32Weight, LoopCount: Integer;    CocoaWeight: NSInteger;    FTmpFont: NSFont; +  IsDefault: Boolean;  begin    inherited Create(AGlobal); @@ -570,7 +571,18 @@      // because otherwise the result is wrong in Mac OS X 10.11, see bug 30300      // Code used for 10.10 or inferior:      // FName := NSStringToString(NSFont.systemFontOfSize(0).familyName); -    if IsFontNameDefault(FName) then +    // +    // There's a differnet issue with not using systemFont. +    // NSComboBox, if assigned a manually created font have an odd ascending-offset +    // (easily seen in Xcode interface builder as well). systemFonts() +    // don't have such issue at all. see bug 33626 +    // the fix below (detecting "default" font and use systemFont()) is a potential +    // regression for bug 30300. +    // +    // There might font properties (i.e. Transform Matrix) to adjust the position of +    // the font. But at this time, it's safer to use systemFont() method +    IsDefault := IsFontNameDefault(FName); +    if not IsDefault then      begin        FTmpFont := NSFont.fontWithName_size(NSFont.systemFontOfSize(0).fontDescriptor.postscriptName, 0);        FName := NSStringToString(FTmpFont.familyName); @@ -594,14 +606,14 @@        include(FStyle, cfs_StrikeOut);      // If this is not a "systemFont" Create the font ourselves -    FontName := NSStringUTF8(FName); -    Attributes := NSDictionary.dictionaryWithObjectsAndKeys( -          FontName, NSFontFamilyAttribute, -          NSNumber.numberWithFloat(FSize), NSFontSizeAttribute, -          nil); -    FontName.release; -    Descriptor := NSFontDescriptor.fontDescriptorWithFontAttributes(Attributes); -    FFont := NSFont.fontWithDescriptor_textTransform(Descriptor, nil); +    if IsDefault then +    begin +      FFont := NSFont.systemFontOfSize( FSize ); +    end else begin +      FontName := NSStringUTF8(FName); +      FFont := NSFont.fontWithName_size(FontName, FSize); +      FontName.release; +    end;      if FFont = nil then      begin @@ -620,7 +632,6 @@          exit;        end;      end; -      // we could use NSFontTraitsAttribute to request the desired font style (Bold/Italic)      // but in this case we may get NIL as result. This way is safer.      if cfs_Italic in Style then -------------- next part -------------- An HTML attachment was scrubbed... URL: From skalogryz.lists at gmail.com Sun Jul 15 16:24:32 2018 From: skalogryz.lists at gmail.com (Dmitry Boyarintsev) Date: Sun, 15 Jul 2018 10:24:32 -0400 Subject: [Lazarus] Character spacing doubled in R58529 on MacOSX/Cocoa In-Reply-To: <6d280929-6325-410f-75de-b1a7ee17b96a@michael-ring.org> References: <6d280929-6325-410f-75de-b1a7ee17b96a@michael-ring.org> Message-ID: You need to use 58531 On Sunday, July 15, 2018, Michael Ring via Lazarus < lazarus at lists.lazarus-ide.org> wrote: > I today build Lazarus MacOSX/Cocoa from svn and realized that all > characters in the editor seem to have an extra space between each character. > > I did a little compiling of older SVN's and found out that the problem > appeared first in revision 58529. > > > This change in 58529 seems to kill the cat: > > > Index: lcl/interfaces/cocoa/cocoagdiobjects.pas > =================================================================== > --- lcl/interfaces/cocoa/cocoagdiobjects.pas (revision 58528) > +++ lcl/interfaces/cocoa/cocoagdiobjects.pas (working copy) > @@ -559,6 +559,7 @@ > Win32Weight, LoopCount: Integer; > CocoaWeight: NSInteger; > FTmpFont: NSFont; > + IsDefault: Boolean; > begin > inherited Create(AGlobal); > > @@ -570,7 +571,18 @@ > // because otherwise the result is wrong in Mac OS X 10.11, see bug > 30300 > // Code used for 10.10 or inferior: > // FName := NSStringToString(NSFont.systemFontOfSize(0).familyName); > - if IsFontNameDefault(FName) then > + // > + // There's a differnet issue with not using systemFont. > + // NSComboBox, if assigned a manually created font have an odd > ascending-offset > + // (easily seen in Xcode interface builder as well). systemFonts() > + // don't have such issue at all. see bug 33626 > + // the fix below (detecting "default" font and use systemFont()) is a > potential > + // regression for bug 30300. > + // > + // There might font properties (i.e. Transform Matrix) to adjust the > position of > + // the font. But at this time, it's safer to use systemFont() method > + IsDefault := IsFontNameDefault(FName); > + if not IsDefault then > begin > FTmpFont := NSFont.fontWithName_size(NSFont.systemFontOfSize(0).fontDescriptor.postscriptName, > 0); > FName := NSStringToString(FTmpFont.familyName); > @@ -594,14 +606,14 @@ > include(FStyle, cfs_StrikeOut); > > // If this is not a "systemFont" Create the font ourselves > - FontName := NSStringUTF8(FName); > - Attributes := NSDictionary.dictionaryWithObjectsAndKeys( > - FontName, NSFontFamilyAttribute, > - NSNumber.numberWithFloat(FSize), NSFontSizeAttribute, > - nil); > - FontName.release; > - Descriptor := NSFontDescriptor.fontDescriptorWithFontAttribut > es(Attributes); > - FFont := NSFont.fontWithDescriptor_textTransform(Descriptor, nil); > + if IsDefault then > + begin > + FFont := NSFont.systemFontOfSize( FSize ); > + end else begin > + FontName := NSStringUTF8(FName); > + FFont := NSFont.fontWithName_size(FontName, FSize); > + FontName.release; > + end; > > if FFont = nil then > begin > @@ -620,7 +632,6 @@ > exit; > end; > end; > - > // we could use NSFontTraitsAttribute to request the desired font > style (Bold/Italic) > // but in this case we may get NIL as result. This way is safer. > if cfs_Italic in Style then > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lazarus at mfriebe.de Sun Jul 15 16:40:49 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Sun, 15 Jul 2018 16:40:49 +0200 Subject: [Lazarus] TESTERS NEEDED / ALL PLATFORMS / COPY AND PASTE / Re: Copy to clipboard from synedit In-Reply-To: <20180715143930.A8BB221F@atlas.cz> References: <20180715111814.258ca823@limapholos.matflo.wg> <20180715143930.A8BB221F@atlas.cz> Message-ID: <45da6cd7-0cb4-f2dd-0f47-cee17c8bde0b@mfriebe.de> On 15/07/2018 14:39, Vojtěch Čihák via Lazarus wrote: > > Hi, > > I tested with Lazarus 1.9.0 r58530M FPC 3.1.1 x86_64-linux-qt. I tried > also with -dDisableUTF8RTL > > All works well with two exceptions: > > 1) folded block is copied folded only in implementation section. In > interface section become unfolded (for example block TForm1 = > class(TForm)...) > Just tested, seems to depend: if I paste it (folded TForm) into the "type" section, then it works. Otherwise not. That is probably unrelated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at michael-ring.org Sun Jul 15 16:52:06 2018 From: mail at michael-ring.org (Michael Ring) Date: Sun, 15 Jul 2018 16:52:06 +0200 Subject: [Lazarus] Character spacing doubled in R58529 on MacOSX/Cocoa In-Reply-To: References: <6d280929-6325-410f-75de-b1a7ee17b96a@michael-ring.org> Message-ID: <04268f14-648a-4ba1-4952-0b33457cd3ea@michael-ring.org> Problem fixed, thank you very much! Michael Am 15.07.18 um 16:24 schrieb Dmitry Boyarintsev: > You need to use 58531 > > On Sunday, July 15, 2018, Michael Ring via Lazarus > > > wrote: > > I today build Lazarus MacOSX/Cocoa**from svn and realized that all > characters in the editor seem to have an extra space between each > character. > > I did a little compiling of older SVN's and found out that the > problem appeared first in revision 58529. > > > This change in 58529 seems to kill the cat: > > > Index: lcl/interfaces/cocoa/cocoagdiobjects.pas > =================================================================== > --- lcl/interfaces/cocoa/cocoagdiobjects.pas (revision 58528) > +++ lcl/interfaces/cocoa/cocoagdiobjects.pas (working copy) > @@ -559,6 +559,7 @@ >    Win32Weight, LoopCount: Integer; >    CocoaWeight: NSInteger; >    FTmpFont: NSFont; > +  IsDefault: Boolean; >  begin >    inherited Create(AGlobal); > > @@ -570,7 +571,18 @@ >      // because otherwise the result is wrong in Mac OS X 10.11, > see bug 30300 >      // Code used for 10.10 or inferior: >      // FName := > NSStringToString(NSFont.systemFontOfSize(0).familyName); > -    if IsFontNameDefault(FName) then > +    // > +    // There's a differnet issue with not using systemFont. > +    // NSComboBox, if assigned a manually created font have an > odd ascending-offset > +    // (easily seen in Xcode interface builder as well). > systemFonts() > +    // don't have such issue at all. see bug 33626 > +    // the fix below (detecting "default" font and use > systemFont()) is a potential > +    // regression for bug 30300. > +    // > +    // There might font properties (i.e. Transform Matrix) to > adjust the position of > +    // the font. But at this time, it's safer to use systemFont() > method > +    IsDefault := IsFontNameDefault(FName); > +    if not IsDefault then >      begin >        FTmpFont := > NSFont.fontWithName_size(NSFont.systemFontOfSize(0).fontDescriptor.postscriptName, > 0); >        FName := NSStringToString(FTmpFont.familyName); > @@ -594,14 +606,14 @@ >        include(FStyle, cfs_StrikeOut); > >      // If this is not a "systemFont" Create the font ourselves > -    FontName := NSStringUTF8(FName); > -    Attributes := NSDictionary.dictionaryWithObjectsAndKeys( > -          FontName, NSFontFamilyAttribute, > -          NSNumber.numberWithFloat(FSize), NSFontSizeAttribute, > -          nil); > -    FontName.release; > -    Descriptor := > NSFontDescriptor.fontDescriptorWithFontAttributes(Attributes); > -    FFont := NSFont.fontWithDescriptor_textTransform(Descriptor, > nil); > +    if IsDefault then > +    begin > +      FFont := NSFont.systemFontOfSize( FSize ); > +    end else begin > +      FontName := NSStringUTF8(FName); > +      FFont := NSFont.fontWithName_size(FontName, FSize); > +      FontName.release; > +    end; > >      if FFont = nil then >      begin > @@ -620,7 +632,6 @@ >          exit; >        end; >      end; > - >      // we could use NSFontTraitsAttribute to request the desired > font style (Bold/Italic) >      // but in this case we may get NIL as result. This way is safer. >      if cfs_Italic in Style then > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at freepascal.org Sun Jul 15 20:19:35 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 15 Jul 2018 20:19:35 +0200 (CEST) Subject: [Lazarus] Brush Bitmap anomaly Message-ID: Hello, When I draw a rectangle with a brush that contains a bitmap, it's impossible to assign the bitmap directly from a glyph. The following works: (BImage is a TBitBtn), the form is painted with the image on the bitbutton. procedure TMainForm.PaintBitmapBrush; begin FreeAndNil(FBrushBitmap); FBrushBitmap:=TBitmap.Create; FBrushBitmap.Width:=BImage.Glyph.Width; FBrushBitmap.Height:=BImage.Glyph.Height; FBrushBitmap.Canvas.Draw(0,0,BImage.Glyph); Canvas.Brush.Bitmap:=FBrushBitmap; Canvas.Rectangle(0,0,Width-1,Height-1); end; This does not work: procedure TMainForm.PaintBitmapBrush; begin Canvas.Brush.Bitmap:=BImage.Glyph; Canvas.Rectangle(0,0,Width-1,Height-1); end; Is this a bug or is this intentional ? BImage.Glyph is of type TBitmap, so I would expect this to work as well... Michael. From mailinglists at geldenhuys.co.uk Sun Jul 15 21:05:59 2018 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 15 Jul 2018 20:05:59 +0100 Subject: [Lazarus] fpdebug question In-Reply-To: <71d84ad2-53bd-340e-a4fb-6f190418809e@mfriebe.de> References: <20180713160151.8C7F0E3F@atlas.cz> <71d84ad2-53bd-340e-a4fb-6f190418809e@mfriebe.de> Message-ID: On 07/13/18 16:20, Martin Frb via Lazarus wrote: > It was not. > It has been, since your mail. > It no longer is. (That is, it should be fixed in svn now) That is awesome! Only possible in open source. :-) Keep up the good work. 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 fluisgirardi at gmail.com Mon Jul 16 16:09:09 2018 From: fluisgirardi at gmail.com (Fabio Luis Girardi) Date: Mon, 16 Jul 2018 11:09:09 -0300 Subject: [Lazarus] IDE extension Message-ID: Hi! I'm writing an IDE extension (similar to an existing IDE tool that's used to rename component names when you press F2, but it will change the property tag with another keyboard shortcut). I followed the this: http://wiki.freepascal.org/Extending_the_IDE#Adding_a_menu_item to register a tool menu item and a shortcut. Now I don't know how to launch my tool only if a component is selected in the form editor. Any ideas? -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc-gaertnma at netcologne.de Mon Jul 16 16:21:37 2018 From: nc-gaertnma at netcologne.de (Mattias Gaertner) Date: Mon, 16 Jul 2018 16:21:37 +0200 Subject: [Lazarus] IDE extension In-Reply-To: References: Message-ID: <20180716162137.4765e0cb@limapholos.matflo.wg> On Mon, 16 Jul 2018 11:09:09 -0300 Fabio Luis Girardi via Lazarus wrote: > Hi! > > I'm writing an IDE extension (similar to an existing IDE tool that's used > to rename component names when you press F2, but it will change the > property tag with another keyboard shortcut). > > I followed the this: > > http://wiki.freepascal.org/Extending_the_IDE#Adding_a_menu_item > > to register a tool menu item and a shortcut. Now I don't know how to launch > my tool only if a component is selected in the form editor. Any ideas? Maybe this helps: http://wiki.freepascal.org/Extending_the_IDE#Designer_events GlobalDesignHook.GetSelection Mattias From fluisgirardi at gmail.com Mon Jul 16 22:09:29 2018 From: fluisgirardi at gmail.com (Fabio Luis Girardi) Date: Mon, 16 Jul 2018 17:09:29 -0300 Subject: [Lazarus] IDE extension In-Reply-To: <20180716162137.4765e0cb@limapholos.matflo.wg> References: <20180716162137.4765e0cb@limapholos.matflo.wg> Message-ID: Thanks! This is what I'm looking for... Em seg, 16 de jul de 2018 às 11:21, Mattias Gaertner < nc-gaertnma at netcologne.de> escreveu: > On Mon, 16 Jul 2018 11:09:09 -0300 > Fabio Luis Girardi via Lazarus wrote: > > > Hi! > > > > I'm writing an IDE extension (similar to an existing IDE tool that's used > > to rename component names when you press F2, but it will change the > > property tag with another keyboard shortcut). > > > > I followed the this: > > > > http://wiki.freepascal.org/Extending_the_IDE#Adding_a_menu_item > > > > to register a tool menu item and a shortcut. Now I don't know how to > launch > > my tool only if a component is selected in the form editor. Any ideas? > > Maybe this helps: > > http://wiki.freepascal.org/Extending_the_IDE#Designer_events > > GlobalDesignHook.GetSelection > > Mattias > -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From el.es.cr at gmail.com Tue Jul 17 10:34:39 2018 From: el.es.cr at gmail.com (el_es) Date: Tue, 17 Jul 2018 09:34:39 +0100 Subject: [Lazarus] Collapsible try...finally...except...end blocks idea Message-ID: Hi, this idea may need further refining, but it may be easier to handle in Lazarus source editor, than in the compiler, where it was originally posted. In short, to have the nested try...finally/except...end; blocks display in a single tier flatter manner, like try try code block 1; finally code block 2; end; except code block 3; end; display in Lazarus like try code block 1; finally code block 2; except code block 3; end; with similar handling like the collapsible code blocks (e.g. a [+] or [-] on the gutter next to all the try's, depending on what the default setting is, to display or not to display nested try blocks) and handling of more 'sophisticated' nests like try...except...finally...except...end; (that means, in raw source code, this still will display like nested try blocks, not flat, and as such be fed into the compiler). This being handled in Lazarus would mean, that it would work in ANY compiler mode selected (regardless if it's Delphi or not) and the benefits of flatter display of the code blocks would really show (like making it harder to enter code blocks where they normally don't go in such constructs, and helping to catch errors made like that - e.g. if someone consciously needed to put code in places it does not normally go, collapsing the construct would not work). It was met with resistance in the FPC mailing lists, and then it was dropped there; I can't say I don't agree with /some/ of their arguments actually. Hope this would actually make more sense here :) as a coding tool. Kind Regards el es From lazarus at mfriebe.de Tue Jul 17 11:43:37 2018 From: lazarus at mfriebe.de (Martin Frb) Date: Tue, 17 Jul 2018 11:43:37 +0200 Subject: [Lazarus] Collapsible try...finally...except...end blocks idea In-Reply-To: References: Message-ID: On 17/07/2018 10:34, el_es via Lazarus wrote: > In short, to have the nested try...finally/except...end; blocks display > in a single tier flatter manner, like > > try > try > code block 1; > finally > code block 2; > end; > except > code block 3; > end; > > display in Lazarus like > > try > code block 1; > finally > code block 2; > except > code block 3; > end; > > with similar handling like the collapsible code blocks (e.g. a [+] or [-] on the gutter next to all the try's, > depending on what the default setting is, to display or not to display nested try blocks) > and handling of more 'sophisticated' nests like try...except...finally...except...end; > > (that means, in raw source code, this still will display like nested try blocks, not flat, > and as such be fed into the compiler). > I dont think the code editor will change the indent, for that there are code formatters. (jedi) Display a different indent from what is actually in the text brings up new issues, such as what happens if you edit spaces in the virtual indent. Where to they go in the real text? Despite this, I am not convinced it is should be included. But if someone wants to do a package that install such a feature..... Anyway the compiler already supports the indent you want (the compiler does not care about indent), so you can actually write it like this. try try code block 1; finally code block 2; end; except code block 3; end; All you have to deal with are: - the double "try". - the extra "end" Several solutions ** 1) Use fpc macro support (look up exact syntax, I am writing this from (distant) memory) (this of course will trouble the editors folding detecting and outlining-markup) {$macro on} {$define try2:= try try} {$define thenExcept := end; except} try2 code block 1; finally code block 2; thenExcept code block 3; end; The macro solution also makes it visually clear that you did not forget an opening try. After all it could be that there is an except block that covers a wider amount of code... ** 2) Or (and that could be added to the editor): Have a /hide option for {%region} (same as the current /fold). With /hide the region would be default disappear. try {%region /hide}try{%endregion} code block 1; finally code block 2; {%region /hide}end;{%endregion} except code block 3; end; From el.es.cr at gmail.com Wed Jul 18 10:12:21 2018 From: el.es.cr at gmail.com (el_es) Date: Wed, 18 Jul 2018 09:12:21 +0100 Subject: [Lazarus] Collapsible try...finally...except...end blocks idea In-Reply-To: References: Message-ID: On 17/07/18 10:43, Martin Frb via Lazarus wrote: > On 17/07/2018 10:34, el_es via Lazarus wrote: >> In short, to have the nested try...finally/except...end; blocks display >> in a single tier flatter manner, like >> >> try >>    try >>      code block 1; >>    finally >>      code block 2; >>    end; >> except >>    code block 3; >> end; >> >> display in Lazarus like >> >> try >>    code block 1; >> finally >>    code block 2; >> except >>    code block 3; >> end; >> >> with similar handling like the collapsible code blocks (e.g. a [+] or [-] on the gutter next to all the try's, >> depending on what the default setting is, to display or not to display nested try blocks) >> and handling of more 'sophisticated' nests like try...except...finally...except...end; >> >> (that means, in raw source code, this still will display like nested try blocks, not flat, >> and as such be fed into the compiler). >> > I dont think the code editor will change the indent, for that there > are code formatters. (jedi) Code formatters would always work on the 'unfolded'/'raw' code anyway. This feature would only be about how to display it. > > Display a different indent from what is actually in the text brings > up new issues, such as what happens if you edit spaces in the virtual > indent. Where to they go in the real text? If we treat the left-most column of the code block in question as base line, then I think adding spaces to other lines in the block would not be that much of a problem. > Despite this, I am not > convinced it is should be included. But if someone wants to do a > package that install such a feature..... This is merely an idea submission in hope that someone likes it enough to make it, and take all the credit for it (I do not mind). > > Anyway the compiler already supports the indent you want (the > compiler does not care about indent), so you can actually write it > like this. > try try >   code block 1; > finally >   code block 2; > end; > except >   code block 3; > end; > > All you have to deal with are: > - the double "try". > - the extra "end" And the possibility that someone might insert code between end; and except; Or anywhere in between the 'try' keywords. Now this is not a big problem in this case, because there may be valid usage of that. If the code display formatter finds this one out, it will refuse to fold and reindent the block, that should then be enough of an indication for the programmer, that this has happened. >   > Several solutions > > ** 1) > Use fpc macro support (look up exact syntax, I am writing this from (distant) memory) > (this of course will trouble the editors folding detecting and outlining-markup) > > {$macro on} > {$define try2:= try try} > {$define thenExcept := end; except} > > try2 >   code block 1; > finally >   code block 2; > thenExcept >   code block 3; > end; I'd name that last macro 'endExcept' maybe, but... > > The macro solution also makes it visually clear that you did not > forget an opening try. After all it could be that there is an except > block that covers a wider amount of code... > > ** 2) > Or (and that could be added to the editor): Have a /hide option for > {%region} (same as the current /fold). With /hide the region would be > default disappear. > try > {%region /hide}try{%endregion} >   code block 1; > finally >   code block 2; > {%region /hide}end;{%endregion} > except >   code block 3; > end; > ... I guess I like the second ({%region hide}) way better than the macros, because with macros you're inventing the whole new set of keywords for this; The only problem with this region directive is that it would mess up the formatting for non-Lazarus editors, and also, how will it behave after the JCF is used? Thanks for your reply :) el_es From friess at gmx.at Fri Jul 20 11:20:04 2018 From: friess at gmx.at (=?UTF-8?Q?Andreas_Frie=c3=9f?=) Date: Fri, 20 Jul 2018 11:20:04 +0200 Subject: [Lazarus] windows EStackOverflow if compiled with -WG Message-ID: I make a project according the sample in http://wiki.freepascal.org/Form_in_DLL Compile the programm with -WG activated and started in Commandline direct, i got a EStackOverflow if i open the form in the dll Compile the programm with -WG deactivated and started in Commandline direct, it runs normal Compile the programm with -WG activate and started in Lazarus (with gdb) it runs normal Compile the programm with -WG deactivate and started in Lazarus (without gdb), i got a EStackOverflow if i open the form in the dll Any hints whats the diffence, or can happens ? Andreas From bo.berglund at gmail.com Fri Jul 20 18:22:02 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 20 Jul 2018 18:22:02 +0200 Subject: [Lazarus] Convert record to JSON? Message-ID: I have an application that manages the configuration of an embedded device, which communicates over TCP/IP. Currently I have implmented a protocol with a command identifier for each data item and the way to send the data is by sending a packet with the command ID plus the data to the open socket. This is less than optimal but was done when the config item number was low, but it seems to increase over time so I want to find a better way. I have just looked into fpJSON a bit (read the wiki but no coding yet). I have this question: The config data are stored in a record and consists of a mix of data types like strings and numbers as well as booleans. Is there a simple way to encode the record as a JSON message to be sent to the device with all of the information in one packet? If so how would one go about coding that transformation? If possible I would like it to be transparent such that if the record is extended later it would automatically include the new members? -- Bo Berglund Developer in Sweden From aaa5500 at ya.ru Fri Jul 20 19:09:25 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Fri, 20 Jul 2018 20:09:25 +0300 Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: Message-ID: > The config data are stored in a record and consists of a mix of data > types like strings and numbers as well as booleans. > Is there a simple way to encode the record as a JSON message Yes, it is. You can write to json values by path: /dir1/dir2/dir3/key, so for your record, make string paths for your values: /myrec/keybool ; /myrec/keyint ; ... -- Regards, Alexey From bo.berglund at gmail.com Fri Jul 20 19:33:19 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 20 Jul 2018 19:33:19 +0200 Subject: [Lazarus] Convert record to JSON? References: Message-ID: On Fri, 20 Jul 2018 20:09:25 +0300, AlexeyT via Lazarus wrote: > >> The config data are stored in a record and consists of a mix of data >> types like strings and numbers as well as booleans. >> Is there a simple way to encode the record as a JSON message > >Yes, it is. You can write to json values by path: /dir1/dir2/dir3/key, > >so for your record, make string paths for your values: /myrec/keybool ; >/myrec/keyint ; ... > I am not sure I understand your suggestion... I was thinking something like this (based on an example in the wiki (http://wiki.freepascal.org/Streaming_JSON): type TMyRecord = record checksum: word; ssid: AnsiString; passwd: AnsiString; macaddr: AnsiString; addr: TIpAddress; baud: integer; tcpport: word; mode: byte; channel: byte; hidden: byte; // hidden (1) or visible (0) fixedaddress: byte; //Station mode fixed addr instead of DHCP numsensors: byte; //Number of active DHT sensors (0..3) dhtinterval: word; // Interval between DHT sensor readings (min) host: AnsiString; reserved: array[0..18] of byte; end; function RecToJSON(RC: TMyrecord): string; var JS: TJSONStreamer; begin JS := TJSONStreamer.Create(NIL); try JS.Options := JS.Options + [jsoTStringsAsArray]; Result := JS.RecordToJSONString(RC); //Seems not to exist... finally JS.Free; end; end; So I have two issues here: 1) It seems like there is no RecordToJSONString method only ObjectToJSONString. 2) Do I have to convert my record to an object just to be able to use JSON with it? I want to avoid having to maintain a function where every member of the record will be individually handled by name, then I don't gain anything by going for JSON regarding future additions. I want the output of the RecToJSON function to contain the field names and current values of the record without ever changing this function in the future when new fields are added.... Is this at all possible? -- Bo Berglund Developer in Sweden From michael at freepascal.org Fri Jul 20 19:41:59 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Fri, 20 Jul 2018 19:41:59 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: Message-ID: On Fri, 20 Jul 2018, Bo Berglund via Lazarus wrote: > On Fri, 20 Jul 2018 20:09:25 +0300, AlexeyT via Lazarus > wrote: > >> >>> The config data are stored in a record and consists of a mix of data >>> types like strings and numbers as well as booleans. >>> Is there a simple way to encode the record as a JSON message >> >> Yes, it is. You can write to json values by path: /dir1/dir2/dir3/key, >> >> so for your record, make string paths for your values: /myrec/keybool ; >> /myrec/keyint ; ... >> > > I am not sure I understand your suggestion... > > I was thinking something like this (based on an example in the wiki > (http://wiki.freepascal.org/Streaming_JSON): > > type TMyRecord = record > checksum: word; > ssid: AnsiString; > passwd: AnsiString; > macaddr: AnsiString; > addr: TIpAddress; > baud: integer; > tcpport: word; > mode: byte; > channel: byte; > hidden: byte; // hidden (1) or visible (0) > fixedaddress: byte; //Station mode fixed addr instead of DHCP > numsensors: byte; //Number of active DHT sensors (0..3) > dhtinterval: word; // Interval between DHT sensor readings (min) > host: AnsiString; > reserved: array[0..18] of byte; > end; > > > function RecToJSON(RC: TMyrecord): string; > var > JS: TJSONStreamer; > begin > JS := TJSONStreamer.Create(NIL); > try > JS.Options := JS.Options + [jsoTStringsAsArray]; > Result := JS.RecordToJSONString(RC); //Seems not to exist... > finally > JS.Free; > end; > end; > > So I have two issues here: > 1) It seems like there is no RecordToJSONString method only > ObjectToJSONString. > > 2) Do I have to convert my record to an object just to be able to use > JSON with it? > > I want to avoid having to maintain a function where every member of > the record will be individually handled by name, then I don't gain > anything by going for JSON regarding future additions. > I want the output of the RecToJSON function to contain the field names > and current values of the record without ever changing this function > in the future when new fields are added.... > > Is this at all possible? For classes it is possible, but not for records (yet). See the jsonrtti unit. Michael. From aaa5500 at ya.ru Fri Jul 20 20:56:40 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Fri, 20 Jul 2018 21:56:40 +0300 Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: Message-ID: On 20.07.2018 20:33, Bo Berglund via Lazarus wrote: > So I have two issues here: > 1) It seems like there is no RecordToJSONString method only > ObjectToJSONString. No function; I was suggesting to make it (func) to your record type (each rec type has its new function). So record type will convert to {   "myrec": {      "int_var": 10,     "bool_var": False,     "str_var": "ddd"    } } -- Regards, Alexey From bo.berglund at gmail.com Fri Jul 20 23:43:19 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 20 Jul 2018 23:43:19 +0200 Subject: [Lazarus] Convert record to JSON? References: Message-ID: On Fri, 20 Jul 2018 19:33:19 +0200, Bo Berglund via Lazarus wrote: I changed my code now so my recrd is instead an object: type TMyRecord = Class(TObject) checksum: word; ssid: AnsiString; passwd: AnsiString; macaddr: AnsiString; addr: TIpAddress; baud: integer; tcpport: word; mode: byte; channel: byte; hidden: byte; // hidden (1) or visible (0) fixedaddress: byte; //Station mode fixed addr instead of DHCP numsensors: byte; //Number of active DHT sensors (0..3) dhtinterval: word; // Interval between DHT sensor readings (min) host: AnsiString; end; I also changed my function to create the JSON string: function RecToJSON(RC: TMyrecord): string; var JS: TJSONStreamer; begin JS := TJSONStreamer.Create(NIL); try JS.Options := JS.Options + [jsoTStringsAsArray]; Result := JS.ObjectToJSONString(RC); finally JS.Free; end; end; When I run this code in my existing application I can step into the line Result := JS.ObjectToJSONString(RC); and hover the mouse over RC and it displays the correct values for all fields of the object. But when the line executes the result is a string with only this empty content: {} Why is this? What have I done wrong? -- Bo Berglund Developer in Sweden From michael at freepascal.org Sat Jul 21 09:29:29 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 21 Jul 2018 09:29:29 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: Message-ID: On Fri, 20 Jul 2018, Bo Berglund via Lazarus wrote: > On Fri, 20 Jul 2018 19:33:19 +0200, Bo Berglund via Lazarus > wrote: > > I changed my code now so my recrd is instead an object: > > type TMyRecord = Class(TObject) > checksum: word; > ssid: AnsiString; > passwd: AnsiString; > macaddr: AnsiString; > addr: TIpAddress; > baud: integer; > tcpport: word; > mode: byte; > channel: byte; > hidden: byte; // hidden (1) or visible (0) > fixedaddress: byte; //Station mode fixed addr instead of DHCP > numsensors: byte; //Number of active DHT sensors (0..3) > dhtinterval: word; // Interval between DHT sensor readings (min) > host: AnsiString; > end; > > I also changed my function to create the JSON string: > > function RecToJSON(RC: TMyrecord): string; > var > JS: TJSONStreamer; > begin > JS := TJSONStreamer.Create(NIL); > try > JS.Options := JS.Options + [jsoTStringsAsArray]; > Result := JS.ObjectToJSONString(RC); > finally > JS.Free; > end; > end; > > When I run this code in my existing application I can step into the > line > Result := JS.ObjectToJSONString(RC); > and hover the mouse over RC and it displays the correct values for all > fields of the object. > > But when the line executes the result is a string with only this empty > content: > > {} > > Why is this? > What have I done wrong? Because RTTI is made only for published properties. So, you must make it published properties: Type { needed if you want to descend from TObject. You can also descend from TPersistent. } {$M+} TMyRecord = Class(TObject) Published Property checksum: word Read FChecksum Write FCheckSum; // etc. end; Michael. From aaa5500 at ya.ru Sat Jul 21 13:28:13 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Sat, 21 Jul 2018 14:28:13 +0300 Subject: [Lazarus] FileUtils.DeleteDirectory help Message-ID: <3c618a49-2821-0da2-e408-bde614c6a908@ya.ru> Pls add a comment to FileUtil.DeleteDirectoty() about 2nd parameter OnlyChildren. my guesses were: - delete only subitems of dir, of one level, but don't delete dir - delete only subitems, of ALL levels, but leave source dir - delete ALSO subitems of ALL levels I still cannot guess it. -- Regards, Alexey From bo.berglund at gmail.com Sat Jul 21 13:45:49 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Sat, 21 Jul 2018 13:45:49 +0200 Subject: [Lazarus] Convert record to JSON? References: Message-ID: On Sat, 21 Jul 2018 09:29:29 +0200 (CEST), Michael Van Canneyt via Lazarus wrote: >> What have I done wrong? > >Because RTTI is made only for published properties. > >So, you must make it published properties: > >Type > >{ needed if you want to descend from TObject. > You can also descend from TPersistent. } > >{$M+} > TMyRecord = Class(TObject) > Published > Property checksum: word Read FChecksum Write FCheckSum; > // etc. > end; > I changed my definition as above: {$M+} TEspConfiguration = Class(TObject) //object published checksum: word; ssid: AnsiString; passwd: AnsiString; macaddr: AnsiString; addr: TIpAddress; baud: integer; .... end; but then when I compile I get this error (14 times): wificommhandler.pas(81,5) Error: Symbol cannot be published, can be only a class Do I need to declare the fields as private first so they can later be declared published? Or are these fields (simple variables and ansistrings) incompatible with the fpc JSON handling? (Must be a class...) Maybe it is simpler after all to code this without using fpcjson. The JSON structure is not that complicated to handle, especially for writing.... -- Bo Berglund Developer in Sweden From wkitty42 at windstream.net Sat Jul 21 17:32:35 2018 From: wkitty42 at windstream.net (wkitty42 at windstream.net) Date: Sat, 21 Jul 2018 11:32:35 -0400 Subject: [Lazarus] FileUtils.DeleteDirectory help In-Reply-To: <3c618a49-2821-0da2-e408-bde614c6a908@ya.ru> References: <3c618a49-2821-0da2-e408-bde614c6a908@ya.ru> Message-ID: <1d748252-6138-96fb-086b-a3815851afdd@windstream.net> On 07/21/2018 07:28 AM, AlexeyT via Lazarus wrote: > Pls add a comment to FileUtil.DeleteDirectoty() about 2nd parameter OnlyChildren. > my guesses were: > - delete only subitems of dir, of one level, but don't delete dir > - delete only subitems, of ALL levels, but leave source dir > - delete ALSO subitems of ALL levels > > I still cannot guess it. even after testing on a disposable tree with structure /foo1/ /foo1/bar1.txt /foo1/foo2/ /foo1/foo2/bar2.txt /foo1/foo2/foo3/ /foo1/foo2/foo3/bar3.txt ?? -- 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 pascaldragon at googlemail.com Sat Jul 21 17:47:54 2018 From: pascaldragon at googlemail.com (Sven Barth) Date: Sat, 21 Jul 2018 17:47:54 +0200 Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: Message-ID: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Am 21.07.2018 um 13:45 schrieb Bo Berglund via Lazarus: > On Sat, 21 Jul 2018 09:29:29 +0200 (CEST), Michael Van Canneyt via > Lazarus wrote: > >>> What have I done wrong? >> Because RTTI is made only for published properties. >> >> So, you must make it published properties: >> >> Type >> >> { needed if you want to descend from TObject. >> You can also descend from TPersistent. } >> >> {$M+} >> TMyRecord = Class(TObject) >> Published >> Property checksum: word Read FChecksum Write FCheckSum; >> // etc. >> end; >> > I changed my definition as above: > > {$M+} > TEspConfiguration = Class(TObject) //object > published > checksum: word; > ssid: AnsiString; > passwd: AnsiString; > macaddr: AnsiString; > addr: TIpAddress; > baud: integer; > .... > end; > > > but then when I compile I get this error (14 times): > > wificommhandler.pas(81,5) Error: Symbol cannot be published, can be > only a class > > Do I need to declare the fields as private first so they can later be > declared published? > > Or are these fields (simple variables and ansistrings) incompatible > with the fpc JSON handling? (Must be a class...) > > Maybe it is simpler after all to code this without using fpcjson. > The JSON structure is not that complicated to handle, especially for > writing.... Look at the code that Michael wrote. He used properties on purpose, because only *properties* can be published while not being a class type. Also even if you don't use ObjectToJSONString you can still use fpJSON as that deals with the whole writing/reading part. You only need to serialize/deserialize your record manually. That said please find attached a unit that serializes (nearly) any record to JSON and reads it back again. It might be buggy, but a quick test with your example record worked. It's compatible with both 3.0.4 as well as 3.1.1. Variant records work correctly as well as thankfully managed types can't be used with them thus simply writing/reading the memory multiple times works, at least as long as no one modified the streamed data. :P As it's two class helpers you can use them like this (Note: for the test I implemented an "=" operator overload for your record): === code begin === uses   fpjson, fpjson.helper, fpjsonrtti; var   streamer: TJSONStreamer;   destreamer: TJSONDeStreamer;   s: TJSONStringType;   t1, t2: TMyRecord; begin   // init t1   // ...   streamer := TJSONStreamer.Create(Nil);   try     s := streamer.RecordToJSONString(@t1, TypeInfo(t1));     Writeln('Serialized record:');     Writeln(s);   finally     streamer.Free;   end;   Writeln;   destreamer := TJSONDeStreamer.Create(Nil);   try     destreamer.JSONToRecord(s, @t2, TypeInfo(t2));     Writeln('Equal deserialized records: ', BoolToStr(t1 = t2, True));   finally     destreamer.Free;   end; end. === code end === The output then looks like this: === output begin === Serialized record: { "Field1" : 17185, "Field2" : "Blubb", "Field3" : "Bla", "Field4" : "54:43:67:94:30:59", "Field5" : { "Field1" : 127, "Field2" : 0, "Field3" : 0, "Field4" : 1, "Field5" : 16777343 }, "Field6" : 115200, "Field7" : 80, "Field8" : 66, "Field9" : 2, "Field10" : 1, "Field11" : 3, "Field12" : 28, "Field13" : 21044, "Field14" : "World", "Field15" : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } Equal deserialized records: True === output end === Note: As the RTTI for records (currently) does not contain the field names index values are used. Generic methods in trunk can even improve this a bit more (at least once I've fixed the bug I've found there): === code begin === s := streamer.RecordToJSONString(@t1, TypeInfo(t1)); // becomes s := streamer.specialize RecordToJSONString(t1); destreamer.JSONToRecord(s, @t2, TypeInfo(t2)); // becomes destreamer.specialize JSONToRecord(s, t2); === code end === @Michael: maybe we can integrate this in fpjsonrtti directly? Regards, Sven -------------- next part -------------- { JSON RTTI (de)streamer for records Copyright (c) 2018 by Sven Barth This file is licensed under the LGPL with static linking exception as used by Free Pascal; see COPYING.FPC of a Free Pascal distribution for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} unit fpjson.helper; {$mode objfpc}{$H+} interface {$ifndef ver3_0} { there still seems to be a bug in trunk regarding overloads with non generic methods, so disable them for now } {.$define enable_gen_funcs} {$endif} uses fpjson, fpjsonrtti, typinfo; type TJSONStreamerHelper = class helper for TJSONStreamer private function StreamArray(aPointer: Pointer; aTypeInfo: PTypeInfo): TJSONArray; function StreamField(aPointer: Pointer; aTypeInfo: PTypeInfo; const aName: String): TJSONData; public function RecordToJSON(aRecord: Pointer; aTypeInfo: PTypeInfo): TJSONObject; {$ifdef enable_gen_funcs} generic function RecordToJSON(constref aRecord: T): TJSONObject; inline; {$endif} function RecordToJSONString(aRecord: Pointer; aTypeInfo: PTypeInfo): TJSONStringType; {$ifdef enable_gen_funcs} generic function RecordToJSONString(constref aRecord: T): TJSONStringType; inline; {$endif} end; TJSONDeStreamerHelper = class helper for TJSONDeStreamer private procedure RestoreArray(aPointer: Pointer; aTypeInfo: PTypeInfo; aArrayData: TJSONArray); procedure DoRestoreField(aPointer: Pointer; aTypeInfo: PTypeInfo; aFieldData: TJSONData; const aName: String); procedure RestoreField(aPointer: Pointer; aTypeInfo: PTypeInfo; aFieldData: TJSONData; const aName: String); public procedure JSONToRecord(const aJSON: TJSONStringType; aRecord: Pointer; aTypeInfo: PTypeInfo); procedure JSONToRecord(const aJSON: TJSONObject; aRecord: Pointer; aTypeInfo: PTypeInfo); {$ifdef enable_gen_funcs} generic procedure JSONToRecord(const aJSON: TJSONStringType; out aRecord: T); generic procedure JSONToRecord(const aJSON: TJSONObject; out aRecord: T); {$endif} end; implementation uses SysUtils; resourcestring SErrUnknownFieldKind = 'Unknown field kind for field: %s'; SErrUnsupportedFieldKind = 'Unsupported field kind for field: %s'; SErrArrayCountMismatch = 'Array count does not match; expected count of %d, but got %d'; SErrUnSupportedEnumDataType = 'Unsupported JSON type for enumerated property "%s" : "%s"'; SErrUnsupportedJSONType = 'Cannot destream object from JSON data of type "%s"'; type TSet = set of 0..31; { TJSONDeStreamerHelper } procedure TJSONDeStreamerHelper.RestoreArray(aPointer: Pointer; aTypeInfo: PTypeInfo; aArrayData: TJSONArray); var td: PTypeData; elsize: LongInt; i: LongInt; begin { for now we stream the array as a flat array even if it's a multi dim one } td := GetTypeData(aTypeInfo); elsize := td^.ArrayData.Size div td^.ArrayData.ElCount; if td^.ArrayData.ElCount <> aArrayData.Count then Error(sErrArrayCountMismatch, [td^.ArrayData.ElCount, aArrayData.Count]); for i := 0 to td^.ArrayData.ElCount - 1 do begin DoRestoreField(PByte(aPointer) + elsize * i, td^.ArrayData.ElType, aArrayData.Items[i], 'Array ' + IntToStr(i)); end; end; procedure TJSONDeStreamerHelper.DoRestoreField(aPointer: Pointer; aTypeInfo: PTypeInfo; aFieldData: TJSONData; const aName: String); var td: PTypeData; procedure SetIntegerField; begin case td^.OrdType of otSByte: PInt8(aPointer)^ := aFieldData.AsInteger; otUByte: PUInt8(aPointer)^ := aFieldData.AsInteger; otSWord: PInt16(aPointer)^ := aFieldData.AsInteger; otUWord: PUInt16(aPointer)^ := aFieldData.AsInteger; otSLong: PInt32(aPointer)^ := aFieldData.AsInteger; otULong: PUInt32(aPointer)^ := aFieldData.AsInteger; {$ifndef ver3_0} otSQWord: PInt64(aPointer)^ := aFieldData.AsInt64; otUQWord: PUInt64(aPointer)^ := aFieldData.AsQWord; {$endif} end; end; procedure SetOrdValue(aValue: LongInt); begin case td^.OrdType of otSByte: PInt8(aPointer)^ := aValue; otUByte: PUInt8(aPointer)^ := aValue; otSWord: PInt16(aPointer)^ := aValue; otUWord: PUInt16(aPointer)^ := aValue; otSLong: PInt32(aPointer)^ := aValue; otULong: PUInt32(aPointer)^ := aValue; {$ifndef ver3_0} otSQWord: PInt64(aPointer)^ := aValue; otUQWord: PUInt64(aPointer)^ := aValue; {$endif} end; end; procedure SetFloatField(aValue: Extended); begin case td^.FloatType of ftSingle: PSingle(aPointer)^ := aValue; ftDouble: PDouble(aPointer)^ := aValue; ftExtended: PExtended(aPointer)^ := aValue; ftComp: PComp(aPointer)^ := Comp(aValue); ftCurr: PCurrency(aPointer)^ := Currency(aValue); end; end; var js: TJSONStringType; a: TJSONArray; s, i, j: LongInt; begin td := GetTypeData(aTypeInfo); case aTypeInfo^.Kind of tkUnknown : Error(SErrUnknownFieldKind, [aName]); tkInteger : SetIntegerField; tkInt64 : PInt64(aPointer)^ := aFieldData.AsInt64; tkEnumeration : begin if aFieldData.JSONType = jtNumber then i := aFieldData.AsInteger else if aFieldData.JSONType = jtString then i := GetEnumValue(aTypeInfo, aFieldData.AsString) else Error(SErrUnSupportedEnumDataType,[aName, JSONTypeName(aFieldData.JSONType)]); SetOrdValue(i); end; tkFloat : begin if (aTypeInfo = TypeInfo(TDateTime)) and (aFieldData.JSONType = jtString) then SetFloatField(ExtractDateTime(aFieldData.AsString)) else SetFloatField(aFieldData.AsFloat) end; tkSet : if aFieldData.JSONType = jtString then SetOrdValue(StringToSet(aTypeInfo, aFieldData.AsString)) else if aFieldData.JSONType = jtArray then begin a := aFieldData as TJSONArray; s := 0; for i := 0 to A.Count-1 do begin if a.Types[i] = jtNumber then j := a.Integers[i] else j := GetEnumValue(td^.CompType, a.Strings[i]); TSet(S) := TSet(S) + [j]; end; SetOrdValue(s); end; tkChar: begin js := aFieldData.AsString; if js <> '' then SetOrdValue(Ord(js[1])); end; tkSString: PShortString(aPointer)^ := aFieldData.AsString; tkLString, tkAString: PAnsiString(aPointer)^ := aFieldData.AsString; tkWString : PWideString(aPointer)^ := aFieldData.AsUnicodeString; tkVariant: PVariant(aPointer)^ := JSONToVariant(aFieldData); tkWChar : begin js := aFieldData.AsString; if js <> '' then SetOrdValue(Ord(js[1])); end; tkBool : SetOrdValue(Ord(aFieldData.AsBoolean)); tkQWord : PQWord(aPointer)^ := aFieldData.AsQWord; tkArray: RestoreArray(aPointer, aTypeInfo, aFieldData as TJSONArray); tkRecord: JSONToRecord(aFieldData as TJSONObject, aPointer, aTypeInfo); tkClass, tkObject, tkInterface, tkDynArray, tkInterfaceRaw, tkProcVar, tkMethod : Error(SErrUnsupportedFieldKind, [aName]); tkUString : PUnicodeString(aPointer)^ := aFieldData.AsUnicodeString; tkUChar: begin js := aFieldData.AsString; if js <> '' then SetOrdValue(Ord(js[1])); end; end; end; procedure TJSONDeStreamerHelper.RestoreField(aPointer: Pointer; aTypeInfo: PTypeInfo; aFieldData: TJSONData; const aName: String); begin try DoRestoreField(aPointer, aTypeInfo, aFieldData, aName); except if not (jdoIgnorePropertyErrors in Options) then raise; end; end; procedure TJSONDeStreamerHelper.JSONToRecord(const aJSON: TJSONStringType; aRecord: Pointer; aTypeInfo: PTypeInfo); var d: TJSONData; begin d := ObjectFromString(aJSON); try If d.JSONType = jtObject then JSONToRecord(d as TJSONObject, aRecord, aTypeInfo) else Error(SErrUnsupportedJSONType, [JSONTypeName(d.JSONType)]); finally d.Free; end; end; procedure TJSONDeStreamerHelper.JSONToRecord(const aJSON: TJSONObject; aRecord: Pointer; aTypeInfo: PTypeInfo); var td: PTypeData; mf: PManagedField; i, j: LongInt; name: TJSONStringType; begin if not Assigned(aJSON) or not Assigned(aRecord) or not Assigned(aTypeInfo) then Exit; if aTypeInfo^.Kind <> tkRecord then Exit; td := GetTypeData(aTypeInfo); {$ifdef ver3_0} { ToDo: check for targets with FPC_REQUIRES_PROPER_ALIGNMENT set } mf := PManagedField(PByte(@td^.ManagedFldCount) + SizeOf(td^.ManagedFldCount)); {$else} mf := PManagedField(AlignTypeData(PByte(@td^.TotalFieldCount) + SizeOf(td^.TotalFieldCount))); {$endif} for i := 0 to {$ifdef ver3_0}td^.ManagedFldCount{$else}td^.TotalFieldCount{$endif} - 1 do begin name := 'Field' + IntToStr(i + 1); j := aJSON.IndexOfName(name, jdoCaseInsensitive in Options); if j >= 0 then RestoreField(PByte(aRecord) + mf^.FldOffset, mf^.TypeRef, aJSON.Items[j], name); Inc(mf); end; end; {$ifdef enable_gen_funcs} generic procedure TJSONDeStreamerHelper.JSONToRecord(const aJSON: TJSONStringType; out aRecord: T); begin JSONToRecord(aJSON, @aRecord, TypeInfo(aRecord)); end; generic procedure TJSONDeStreamerHelper.JSONToRecord(const aJSON: TJSONObject; out aRecord: T); begin JSONToRecord(aJSON, @aRecord, TypeInfo(aRecord)); end; {$endif} { TJSONStreamerHelper } function TJSONStreamerHelper.StreamArray(aPointer: Pointer; aTypeInfo: PTypeInfo ): TJSONArray; var td: PTypeData; elsize: LongInt; ad: TJSONData; i: LongInt; begin Result := TJSONArray.Create; { for now we stream the array as a flat array even if it's a multi dim one } td := GetTypeData(aTypeInfo); elsize := td^.ArrayData.Size div td^.ArrayData.ElCount; for i := 0 to td^.ArrayData.ElCount - 1 do begin try ad := StreamField(PByte(aPointer) + elsize * i, td^.ArrayData.ElType, 'Array ' + IntToStr(i)); Result.Add(ad); except FreeAndNil(Result); raise; end; end; end; function TJSONStreamerHelper.StreamField(aPointer: Pointer; aTypeInfo: PTypeInfo; const aName: String): TJSONData; var td: PTypeData; function GetIntegerField: TJSONData; begin case td^.OrdType of otSByte: Result := TJSONIntegerNumber.Create(PInt8(aPointer)^); otUByte: Result := TJSONIntegerNumber.Create(PUInt8(aPointer)^); otSWord: Result := TJSONIntegerNumber.Create(PInt16(aPointer)^); otUWord: Result := TJSONIntegerNumber.Create(PUInt16(aPointer)^); otSLong: Result := TJSONIntegerNumber.Create(PInt32(aPointer)^); otULong: Result := TJSONIntegerNumber.Create(PUInt32(aPointer)^); {$ifndef ver3_0} otSQWord: Result := TJSONInt64Number.Create(PInt64(aPointer)^); otUQWord: Result := TJSONQWordNumber.Create(PUInt64(aPointer)^); {$endif} end; end; function GetOrdValue: LongInt; begin case td^.OrdType of otSByte: Result := PInt8(aPointer)^; otUByte: Result := PUInt8(aPointer)^; otSWord: Result := PInt16(aPointer)^; otUWord: Result := PUInt16(aPointer)^; otSLong: Result := PInt32(aPointer)^; otULong: Result := LongInt(PUInt32(aPointer)^); {$ifndef ver3_0} otSQWord: Result := LongInt(PInt64(aPointer)^); otUQWord: Result := LongInt(PUInt64(aPointer)^); {$endif} end; end; function GetFloatValue: Extended; begin case td^.FloatType of ftSingle: Result := PSingle(aPointer)^; ftDouble: Result := PDouble(aPointer)^; ftExtended: Result := PExtended(aPointer)^; ftComp: Result := PComp(aPointer)^; ftCurr: Result := PCurrency(aPointer)^; end; end; var s, i: LongInt; f: Extended; begin Result := Nil; td := GetTypeData(aTypeInfo); Case aTypeInfo^.Kind of tkUnknown : Error(SErrUnknownFieldKind, [aName]); tkInteger : Result := GetIntegerField; tkEnumeration : begin i := GetOrdValue; if jsoEnumeratedAsInteger in Options then Result := TJSONIntegerNumber.Create(i) else Result := TJSONString.Create(GetEnumName(aTypeInfo,i)); end; tkFloat : begin f := GetFloatValue; if (aTypeInfo=TypeInfo(TDateTime)) and (jsoDateTimeAsString in Options) then Result := FormatDateProp(f) else Result := TJSONFloatNumber.Create(f); end; tkSet : if jsoSetAsString in Options then Result := TJSONString.Create(SetToString(aTypeInfo, GetOrdValue, jsoSetBrackets in Options)) else begin s := GetOrdValue; Result := TJSONArray.Create; try for i:=0 to 31 do if i in TSet(s) then if jsoSetEnumeratedAsInteger in Options then TJSONArray(Result).Add(i) else TJSONArray(Result).Add(GetEnumName(td^.CompType, i)); except FreeAndNil(Result); raise; end; end; tkChar: Result := TJSONString.Create(Char(GetOrdValue)); tkSString : Result := TJSONString.Create(PShortString(aPointer)^); tkLString, tkAString : Result := TJSONString.Create(PAnsiString(aPointer)^); tkWString : Result := TJSONString.Create(PWideString(aPointer)^); tkVariant: Result := StreamVariant(PVariant(aPointer)^); tkClass: Result := StreamClassProperty(TObject(aPointer)); tkWChar : Result := TJSONString.Create(WideChar(GetOrdValue)); tkBool : Result := TJSONBoolean.Create(GetOrdValue<>0); tkInt64 : Result := TJSONInt64Number.Create(PInt64(aPointer)^); tkQWord : Result := TJSONFloatNumber.Create(PQWord(aPointer)^); tkRecord : Result := RecordToJSON(aPointer, aTypeInfo); tkArray : Result := StreamArray(aPointer, aTypeInfo); tkObject, tkInterface, tkDynArray, tkInterfaceRaw, tkProcVar, tkMethod : Error(SErrUnsupportedFieldKind, [aName]); tkUString : Result := TJSONString.Create(PUnicodeString(aPointer)^); tkUChar: Result := TJSONString.Create(UnicodeChar(GetOrdValue)); end; end; function TJSONStreamerHelper.RecordToJSON(aRecord: Pointer; aTypeInfo: PTypeInfo ): TJSONObject; var td: PTypeData; mf: PManagedField; i: LongInt; name: TJSONStringType; fd: TJSONData; begin if not Assigned(aRecord) or not Assigned(aTypeInfo) then Exit(Nil); if aTypeInfo^.Kind <> tkRecord then Exit(Nil); Result := TJSONObject.Create; try td := GetTypeData(aTypeInfo); {$ifdef ver3_0} { ToDo: check for targets with FPC_REQUIRES_PROPER_ALIGNMENT set } mf := PManagedField(PByte(@td^.ManagedFldCount) + SizeOf(td^.ManagedFldCount)); {$else} mf := PManagedField(AlignTypeData(PByte(@td^.TotalFieldCount) + SizeOf(td^.TotalFieldCount))); {$endif} for i := 0 to {$ifdef ver3_0}td^.ManagedFldCount{$else}td^.TotalFieldCount{$endif} - 1 do begin name := 'Field' + IntToStr(i + 1); fd := StreamField(PByte(aRecord) + mf^.FldOffset, mf^.TypeRef, name); if Assigned(fd) then begin if jsoLowerPropertyNames in Options then name := LowerCase(name); Result.Add(name, fd); end; Inc(mf); end; except FreeAndNil(Result); raise; end; end; {$ifdef enable_gen_funcs} generic function TJSONStreamerHelper.RecordToJSON(constref aRecord: T): TJSONObject; begin Result := RecordToJSON(@aRecord, TypeInfo(aRecord)); end; {$endif} function TJSONStreamerHelper.RecordToJSONString(aRecord: Pointer; aTypeInfo: PTypeInfo): TJSONStringType; var o: TJSONData; begin o := RecordToJSON(aRecord, aTypeInfo); try if jsoUseFormatString in Options then Result := o.FormatJSON else Result := o.AsJSON; finally o.Free; end; end; {$ifdef enable_gen_funcs} generic function TJSONStreamerHelper.RecordToJSONString(constref aRecord: T): TJSONStringType; begin Result := RecordToJSONString(@aRecord, TypeInfo(aRecord)); end; {$endif} end. From michael at freepascal.org Sat Jul 21 18:05:30 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 21 Jul 2018 18:05:30 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Message-ID: On Sat, 21 Jul 2018, Sven Barth via Lazarus wrote: > === code begin === > > s := streamer.RecordToJSONString(@t1, TypeInfo(t1)); > // becomes > s := streamer.specialize RecordToJSONString(t1); > > destreamer.JSONToRecord(s, @t2, TypeInfo(t2)); > // becomes > destreamer.specialize JSONToRecord(s, t2); > > === code end === > > @Michael: maybe we can integrate this in fpjsonrtti directly? :-) :-) :-) I am glad you proposed it, saves me the trouble of asking it. I was planning to extend JSONRTTI so it can handle more cases (I want to replace the rest JSON handling with it), so this can definitely be included. I'll study your code and get back to you. Thanks for the sample code !! :) Michael. From pascaldragon at googlemail.com Sat Jul 21 18:26:22 2018 From: pascaldragon at googlemail.com (Sven Barth) Date: Sat, 21 Jul 2018 18:26:22 +0200 Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Message-ID: Am 21.07.2018 um 18:05 schrieb Michael Van Canneyt: > > > On Sat, 21 Jul 2018, Sven Barth via Lazarus wrote: > >> === code begin === >> >> s := streamer.RecordToJSONString(@t1, TypeInfo(t1)); >> // becomes >> s := streamer.specialize RecordToJSONString(t1); >> >> destreamer.JSONToRecord(s, @t2, TypeInfo(t2)); >> // becomes >> destreamer.specialize JSONToRecord(s, t2); >> >> === code end === >> >> @Michael: maybe we can integrate this in fpjsonrtti directly? > > > :-) :-) :-) > > I am glad you proposed it, saves me the trouble of asking it. I was > planning to extend JSONRTTI so it can handle more cases (I want to > replace the rest JSON handling with it), so this can definitely be > included. > > I'll study your code and get back to you. Thanks for the sample code > !! :) There are definitely still some problems with it, e.g. a field of type TObject (or any descendant) currently can't be deserialized as I didn't want to rewrite DeStreamClassProperty. Then there are the sets which for non-published properties can be greater than 32-bit (up to 256-bit currently). Support for dynamic arrays could be added as well. Also I didn't check whether all types serialize/deserialize correctly, e.g. especially the special floating point types Comp and Currency. You'd need to check what Get-/SetFloatProp are doing there. Also I noticed a problem that's also in the TObject based streaming code: WideChar and UnicodeChar are deserialized incorrectly as TJSONStringType is of type UTF8String and thus js[1] might be an invalid character if it's Codepoint happens to be > $7f. Regards, Sven From bo.berglund at gmail.com Sun Jul 22 00:22:58 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 22 Jul 2018 00:22:58 +0200 Subject: [Lazarus] Convert record to JSON? References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Message-ID: On Sat, 21 Jul 2018 17:47:54 +0200, Sven Barth via Lazarus wrote: >Look at the code that Michael wrote. He used properties on purpose, >because only *properties* can be published while not being a class type. Sorry, did not fully note the property keyword! Not doing that made it easier to support both object and record through conditional defines without changing the body of the code... But it now means I have to use a new structure like this: TIpAddress = array[0..3] of byte; TEspConfiguration = Class(TObject) private Fchecksum: word; Fssid: AnsiString; Fpasswd: AnsiString; Fmacaddr: AnsiString; Fhost: AnsiString; Faddr: TIpAddress; Fbaud: integer; Ftcpport: word; Fmode: byte; Fchannel: byte; Fhidden: byte; Ffixedaddress: byte; Fnumsensors: byte; Fdhtinterval: word; published property checksum: word read Fchecksum write Fchecksum; property ssid: AnsiString read Fssid write Fssid ; property passwd: AnsiString read Fpasswd write Fpasswd; property macaddr: AnsiString read Fmacaddr write Fmacaddr; property host: AnsiString read Fhost write Fhost; property addr: TIpAddress read Faddr write Faddr; property baud: integer read Fbaud write Fbaud; property tcpport: word read Ftcpport write Ftcpport; property mode: byte read Fmode write Fmode; property channel: byte read Fchannel write Fchannel; property hidden: byte read Fhidden write Fhidden; property fixedaddress: byte read Ffixedaddress write Ffixedaddress; property numsensors: byte read Fnumsensors write Fnumsensors; property dhtinterval: word read Fdhtinterval write Fdhtinterval; end; Can the JSON handlers deal with the array type TIpAddress? And how do I "plug" the fpjson.helper.pp code into my project? -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Sun Jul 22 07:50:06 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 22 Jul 2018 07:50:06 +0200 Subject: [Lazarus] Convert record to JSON? References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Message-ID: <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> On Sun, 22 Jul 2018 00:22:58 +0200, Bo Berglund via Lazarus wrote: >Can the JSON handlers deal with the array type TIpAddress? Well, it trurns out that this fails earlier on when compiling... So I have: type TIpAddress = array[0..3] of byte; {$M+} TEspConfiguration = Class(TObject) private Fchecksum: word; Fssid: AnsiString; ... Faddr: TIpAddress; //<== ... published property checksum: word read Fchecksum write Fchecksum; property ssid: AnsiString read Fssid write Fssid ; ... property addr: TIpAddress read Faddr write Faddr; // <== ... end When compiling I get the following error on the "property addr" line: wificommhandler.pas(97,33) Error: This kind of property cannot be published If I replace the type declaration TIpAddress with array[0..3] of byte it just adds another error message... Can published properties only be simple variable types not including arrays? Seems odd since an AnsiString, which is accepted, is just an array of AnsiChar. -- Bo Berglund Developer in Sweden From michael at freepascal.org Sun Jul 22 07:52:40 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 22 Jul 2018 07:52:40 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> Message-ID: On Sun, 22 Jul 2018, Bo Berglund via Lazarus wrote: > On Sun, 22 Jul 2018 00:22:58 +0200, Bo Berglund via Lazarus > wrote: > >> Can the JSON handlers deal with the array type TIpAddress? > > Well, it trurns out that this fails earlier on when compiling... > So I have: > > type > TIpAddress = array[0..3] of byte; > > {$M+} > TEspConfiguration = Class(TObject) > private > Fchecksum: word; > Fssid: AnsiString; > ... > Faddr: TIpAddress; //<== > ... > published > property checksum: word read Fchecksum write Fchecksum; > property ssid: AnsiString read Fssid write Fssid ; > ... > property addr: TIpAddress read Faddr write Faddr; // <== > ... > end > > When compiling I get the following error on the "property addr" line: > > wificommhandler.pas(97,33) Error: This kind of property cannot be > published Only dynamic arrays can be published. > > If I replace the type declaration TIpAddress with array[0..3] of byte > it just adds another error message... > > Can published properties only be simple variable types not including > arrays? > Seems odd since an AnsiString, which is accepted, is just an array of > AnsiChar. Yes, but it is a dynamic array. Michael. From pascaldragon at googlemail.com Sun Jul 22 09:29:22 2018 From: pascaldragon at googlemail.com (Sven Barth) Date: Sun, 22 Jul 2018 09:29:22 +0200 Subject: [Lazarus] Convert record to JSON? In-Reply-To: References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> Message-ID: Bo Berglund via Lazarus schrieb am So., 22. Juli 2018, 00:23: > And how do I "plug" the fpjson.helper.pp code into my project? > Simply add the unit to your project and use it where you use fpjsonrtti (in addition to that unit!). The methods are then part of TJSONStreamer and TJSONDeStreamer. The TIpAddress should work with that code as well. Regards, Sven > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo.berglund at gmail.com Sun Jul 22 10:22:53 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 22 Jul 2018 10:22:53 +0200 Subject: [Lazarus] Convert record to JSON? References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> Message-ID: <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> On Sun, 22 Jul 2018 07:52:40 +0200 (CEST), Michael Van Canneyt via Lazarus wrote: >Only dynamic arrays can be published. > So I changed the declaration: TIpAddress = array of byte; Then added a constructor to the class where I set the length to 4: constructor TEspConfiguration.Create; begin SetLength(Faddr,4); end; This removed the errors I had before but popped up another one in my main code: String2IP(FConfRec.addr, edWiFiAddress.Text); //<== Error here formmainconfig.pas(240,26) Error: Can't take the address of constant expressions This function converts an IP address as string into the byte array. The data comes from an editbox where the user enters the IP address required: function TfrmMainConfig.String2IP(var IP: TIpAddress; Addr: string): boolean; var Lst: TStringList; i: integer; t: integer; begin Result := false; Lst := TStringList.Create; try Lst.StrictDelimiter := true; Lst.Delimiter := '.'; Lst.DelimitedText := Addr; if Lst.Count <> 4 then exit; //First requirement, 4 positions for i := 0 to 3 do begin t := StrToIntDef(Lst[i],-1); if (t<0) and (t>255) then exit; //Second, must be byte sized IP[i] := t and $FF; end; Result := true; finally Lst.Free; end; end; So now it looks like I am stuck between two exclusive requirements... -- Bo Berglund Developer in Sweden From michael at freepascal.org Sun Jul 22 10:41:23 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 22 Jul 2018 10:41:23 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> Message-ID: On Sun, 22 Jul 2018, Bo Berglund via Lazarus wrote: > On Sun, 22 Jul 2018 07:52:40 +0200 (CEST), Michael Van Canneyt via > Lazarus wrote: > >> Only dynamic arrays can be published. >> > So I changed the declaration: > > TIpAddress = array of byte; > > Then added a constructor to the class where I set the length to 4: > > constructor TEspConfiguration.Create; > begin > SetLength(Faddr,4); > end; > > This removed the errors I had before but popped up another one in my > main code: > > String2IP(FConfRec.addr, edWiFiAddress.Text); //<== Error here > > formmainconfig.pas(240,26) Error: Can't take the address of constant > expressions That is because you cannot pass the array as a var argument. Just remove the var, for a dynamic array it is not required anyway. Michael. From michael at freepascal.org Sun Jul 22 10:41:23 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 22 Jul 2018 10:41:23 +0200 (CEST) Subject: [Lazarus] Convert record to JSON? In-Reply-To: <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> Message-ID: On Sun, 22 Jul 2018, Bo Berglund via Lazarus wrote: > On Sun, 22 Jul 2018 07:52:40 +0200 (CEST), Michael Van Canneyt via > Lazarus wrote: > >> Only dynamic arrays can be published. >> > So I changed the declaration: > > TIpAddress = array of byte; > > Then added a constructor to the class where I set the length to 4: > > constructor TEspConfiguration.Create; > begin > SetLength(Faddr,4); > end; > > This removed the errors I had before but popped up another one in my > main code: > > String2IP(FConfRec.addr, edWiFiAddress.Text); //<== Error here > > formmainconfig.pas(240,26) Error: Can't take the address of constant > expressions That is because you cannot pass the array as a var argument. Just remove the var, for a dynamic array it is not required anyway. Michael. From bo.berglund at gmail.com Sun Jul 22 15:43:48 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Sun, 22 Jul 2018 15:43:48 +0200 Subject: [Lazarus] Convert record to JSON? References: <8fd10242-6267-c006-da9b-bf903d84db3a@googlemail.com> <8168ldh773tnib0nhfb1qobbcseshnka3e@4ax.com> <33f8ld9evkepc6nuilhmksnpbanhkhvkps@4ax.com> Message-ID: On Sun, 22 Jul 2018 10:41:23 +0200 (CEST), Michael Van Canneyt via Lazarus wrote: >That is because you cannot pass the array as a var argument. Just remove the >var, for a dynamic array it is not required anyway. I did so and the compile error disappeared. However, now that there are no compile time errors instead I get a runtime exception inside the call to ObjectToJSONString here: function TConfigCommHandler.ConfigAsJSON(RC: TEspConfiguration): string; {Create a JSON verson of the configuration record} var JS: TJSONStreamer; begin JS := TJSONStreamer.Create(NIL); try JS.Options := JS.Options + [jsoTStringsAsArray]; Result := JS.ObjectToJSONString(RC); finally JS.Free; end; end; The Exception message is: ' : Unsupported property kind for property: "addr"' So it is still not supported.... -- Bo Berglund Developer in Sweden From friess at gmx.at Mon Jul 23 09:39:47 2018 From: friess at gmx.at (Andreas =?UTF-8?B?RnJpZcOf?=) Date: Mon, 23 Jul 2018 09:39:47 +0200 Subject: [Lazarus] windows EStackOverflow if compiled with -WG In-Reply-To: References: Message-ID: Andreas Frieß via Lazarus wrote: > I make a project according the sample in > http://wiki.freepascal.org/Form_in_DLL > > Compile the programm with -WG activated and started in Commandline > direct, i got a EStackOverflow if i open the form in the dll > With the actual trunk (fpc&Lazarus) i get a EInOutError -> Disk full I found the reason: When i activate LazLogger in the DLL, the error is raised. If i remove LazLogger it works as expected. Is this a Bug in LazLogger or by design ? Andreas From bo.berglund at gmail.com Wed Jul 25 14:04:42 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Wed, 25 Jul 2018 14:04:42 +0200 Subject: [Lazarus] Crosscompile to Android on arm? Message-ID: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> I have a GUI program developed in FPC/Lazarus x64 on Windows. It is an IoT device configuration application which would benefit from being portable, i.e. executable on an Android phone. The devices in question will be placed in locations where configuration would be easier from a phone. Before I start digging in to the multiple pages I have found on the fpc/Android subject I want to ask if it would be feasible to cross-compile my Windows application for Android phone use? I have used standard GUI controls in Lazarus for the visual parts and Indy10 (via indylaz) for the TCP/IP communications stuff. Any advice welcome! But if it turns out to be a learning path several weeks long it is probably not worth the effort... -- Bo Berglund Developer in Sweden From list2010 at BrenemanLabs.com Wed Jul 25 17:47:06 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 11:47:06 -0400 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> Message-ID: <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> On 07/25/2018 08:04 AM, Bo Berglund via Lazarus wrote: > I have a GUI program developed in FPC/Lazarus x64 on Windows. > It is an IoT device configuration application which would benefit from > being portable, i.e. executable on an Android phone. The devices in > question will be placed in locations where configuration would be > easier from a phone. > > Before I start digging in to the multiple pages I have found on the > fpc/Android subject I want to ask if it would be feasible to > cross-compile my Windows application for Android phone use? > > I have used standard GUI controls in Lazarus for the visual parts and > Indy10 (via indylaz) for the TCP/IP communications stuff. > > Any advice welcome! > But if it turns out to be a learning path several weeks long it is > probably not worth the effort... You *hope* to compile a program *directly* on an Android phone with *little* effort? :) You could possibly hire me (or other that I know). Or we could trade things? On 6/11/18 I wrote a message on this forum to you about a security dongle I need to use in Lazarus. I'll trade some work for that code! I've spent a bit of time investigating similar things: http://www.turbocontrol.com/userland.htm http://controlpascal.com/self-hosted.htm I got a couple of these kits several years ago: https://www.anaren.com/search/iot%20product%20bluetooth%20smart%20development%20kit A company who builds waterproof equipment could hopefully use inexpensive Android tablets occasionally to change equipment settings (a *lot* less expensive than adding waterproof user IO equipment to their gear). I'd enjoy hearing more ideas from others! Best regard, Paul www.ControlPascal.com From list2010 at BrenemanLabs.com Wed Jul 25 18:24:54 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 12:24:54 -0400 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: <7de926ad-3cca-ea48-076b-c7d4d52cf56d@BrenemanLabs.com> Sorry that my Anaren link was bad. I haven't found my *old* development kit yet but this works better: https://www.anaren.com/catalog/wireless-transceivers/proprietary-rf My last message to you Bo: http://lists.lazarus-ide.org/pipermail/lazarus/2018-June/234962.html On 07/25/2018 11:47 AM, Paul Breneman via Lazarus wrote: > On 07/25/2018 08:04 AM, Bo Berglund via Lazarus wrote: >> I have a GUI program developed in FPC/Lazarus x64 on Windows. >> It is an IoT device configuration application which would benefit from >> being portable, i.e. executable on an Android phone. The devices in >> question will be placed in locations where configuration would be >> easier from a phone. >> >> Before I start digging in to the multiple pages I have found on the >> fpc/Android subject I want to ask if it would be feasible to >> cross-compile my Windows application for Android phone use? >> >> I have used standard GUI controls in Lazarus for the visual parts and >> Indy10 (via indylaz) for the TCP/IP communications stuff. >> >> Any advice welcome! >> But if it turns out to be a learning path several weeks long it is >> probably not worth the effort... > > You *hope* to compile a program *directly* on an Android phone with > *little* effort?  :) > > You could possibly hire me (or other that I know). > > Or we could trade things? > > On 6/11/18 I wrote a message on this forum to you about a security > dongle I need to use in Lazarus.  I'll trade some work for that code! > > I've spent a bit of time investigating similar things: > > http://www.turbocontrol.com/userland.htm > > http://controlpascal.com/self-hosted.htm > > I got a couple of these kits several years ago: > https://www.anaren.com/search/iot%20product%20bluetooth%20smart%20development%20kit > > > A company who builds waterproof equipment could hopefully use > inexpensive Android tablets occasionally to change equipment settings (a > *lot* less expensive than adding waterproof user IO equipment to their > gear). > > I'd enjoy hearing more ideas from others! > > Best regard, > Paul > www.ControlPascal.com From list2010 at BrenemanLabs.com Wed Jul 25 18:32:20 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 12:32:20 -0400 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <7de926ad-3cca-ea48-076b-c7d4d52cf56d@BrenemanLabs.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> <7de926ad-3cca-ea48-076b-c7d4d52cf56d@BrenemanLabs.com> Message-ID: Sorry again Bo that I missed your *crosscompile* (multiple times)! I'm sure others can help you with that much better than I can. :) On 07/25/2018 12:24 PM, Paul Breneman via Lazarus wrote: > Sorry that my Anaren link was bad.  I haven't found my *old* development > kit yet but this works better: > https://www.anaren.com/catalog/wireless-transceivers/proprietary-rf > > My last message to you Bo: > http://lists.lazarus-ide.org/pipermail/lazarus/2018-June/234962.html > > > On 07/25/2018 11:47 AM, Paul Breneman via Lazarus wrote: >> On 07/25/2018 08:04 AM, Bo Berglund via Lazarus wrote: >>> I have a GUI program developed in FPC/Lazarus x64 on Windows. >>> It is an IoT device configuration application which would benefit from >>> being portable, i.e. executable on an Android phone. The devices in >>> question will be placed in locations where configuration would be >>> easier from a phone. >>> >>> Before I start digging in to the multiple pages I have found on the >>> fpc/Android subject I want to ask if it would be feasible to >>> cross-compile my Windows application for Android phone use? >>> >>> I have used standard GUI controls in Lazarus for the visual parts and >>> Indy10 (via indylaz) for the TCP/IP communications stuff. >>> >>> Any advice welcome! >>> But if it turns out to be a learning path several weeks long it is >>> probably not worth the effort... >> >> You *hope* to compile a program *directly* on an Android phone with >> *little* effort?  :) >> >> You could possibly hire me (or other that I know). >> >> Or we could trade things? >> >> On 6/11/18 I wrote a message on this forum to you about a security >> dongle I need to use in Lazarus.  I'll trade some work for that code! >> >> I've spent a bit of time investigating similar things: >> >> http://www.turbocontrol.com/userland.htm >> >> http://controlpascal.com/self-hosted.htm >> >> I got a couple of these kits several years ago: >> https://www.anaren.com/search/iot%20product%20bluetooth%20smart%20development%20kit >> >> >> A company who builds waterproof equipment could hopefully use >> inexpensive Android tablets occasionally to change equipment settings >> (a *lot* less expensive than adding waterproof user IO equipment to >> their gear). >> >> I'd enjoy hearing more ideas from others! >> >> Best regard, >> Paul >> www.ControlPascal.com > From bo.berglund at gmail.com Wed Jul 25 18:32:51 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Wed, 25 Jul 2018 18:32:51 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Wed, 25 Jul 2018 11:47:06 -0400, Paul Breneman via Lazarus wrote: >You *hope* to compile a program *directly* on an Android phone with >*little* effort? :) Did you read "Crosscompile" as compiling *on* android? I used cross to indicate that the compilation would be done elsewhere like on a regular PC but *targeting* Android. -- Bo Berglund Developer in Sweden From list2010 at BrenemanLabs.com Wed Jul 25 18:39:38 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 12:39:38 -0400 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On 07/25/2018 12:32 PM, Bo Berglund via Lazarus wrote: > On Wed, 25 Jul 2018 11:47:06 -0400, Paul Breneman via Lazarus > wrote: > >> You *hope* to compile a program *directly* on an Android phone with >> *little* effort? :) > > Did you read "Crosscompile" as compiling *on* android? > I used cross to indicate that the compilation would be done elsewhere > like on a regular PC but *targeting* Android. > Yes, I should *finish* my coffee before writing emails! :) From bo.berglund at gmail.com Wed Jul 25 18:47:51 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Wed, 25 Jul 2018 18:47:51 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Wed, 25 Jul 2018 11:47:06 -0400, Paul Breneman via Lazarus wrote: >On 6/11/18 I wrote a message on this forum to you about a security >dongle I need to use in Lazarus. I'll trade some work for that code! > Since I could not make use of the OBJ file for the Sentinel Superpro dongle I started looking for dongle replacements and I got a sample from Keylok (a Keylok3 dongle) that has similar capabilities. Its main attraction is that it does not use a driver installed in the operating system, they say it is "driver-less". But instead they provide a dll to interface with the dongle via the operating system standard USB communications. As an alternative they also have OBJ library file solution which means that the interface will be included in ones own exe file, no dll needed. However they did not have an OBJ file for even Delphi7 for Keylok3... And an OBJ is probably dev IDE dependent too, so the dll is the only way to go if one needs FPC. I have tested it with Delphi7 (as a compatibility check, I expect my code to also run on Lazarus/Fpc) and it is simple enough to get going on Windows. But I put it on hold for the summer vacations... My project for the IoT stuff is private using ESP8266 based WiFi boards to monitor and report here and there around my home... So this is something I do now and then even in this temperature... -- Bo Berglund Developer in Sweden From list2010 at BrenemanLabs.com Wed Jul 25 19:07:10 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 13:07:10 -0400 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On 07/25/2018 12:47 PM, Bo Berglund via Lazarus wrote: > On Wed, 25 Jul 2018 11:47:06 -0400, Paul Breneman via Lazarus > wrote: > >> On 6/11/18 I wrote a message on this forum to you about a security >> dongle I need to use in Lazarus. I'll trade some work for that code! >> > Since I could not make use of the OBJ file for the Sentinel Superpro > dongle I started looking for dongle replacements and I got a sample > from Keylok (a Keylok3 dongle) that has similar capabilities. > Its main attraction is that it does not use a driver installed in the > operating system, they say it is "driver-less". > > But instead they provide a dll to interface with the dongle via the > operating system standard USB communications. As an alternative they > also have OBJ library file solution which means that the interface > will be included in ones own exe file, no dll needed. However they did > not have an OBJ file for even Delphi7 for Keylok3... > > And an OBJ is probably dev IDE dependent too, so the dll is the only > way to go if one needs FPC. > > I have tested it with Delphi7 (as a compatibility check, I expect my > code to also run on Lazarus/Fpc) and it is simple enough to get going > on Windows. > But I put it on hold for the summer vacations... > > My project for the IoT stuff is private using ESP8266 based WiFi > boards to monitor and report here and there around my home... > So this is something I do now and then even in this temperature... Thanks for *all* of that info Bo. My favorite time in Sweden (in 1992) I visited the Vasa. Maybe if I visit again we can meet up? https://www.vasamuseet.se From list2010 at BrenemanLabs.com Wed Jul 25 19:31:08 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Wed, 25 Jul 2018 13:31:08 -0400 Subject: [Lazarus] Using a component OBJ file in Lazarus? In-Reply-To: References: <2e26971a-27e8-c130-0a80-504fe550ee29@lumino.de> <6deffba1-5d93-0eb9-93c5-0b273ebf9823@lumino.de> <96f49d4e-ef4a-7175-e5e0-9ae004d41db1@lumino.de> Message-ID: <975d5a43-e2c6-a01f-9311-1d74ee9cdbb5@BrenemanLabs.com> On 06/20/2018 01:54 AM, Bo Berglund via Lazarus wrote: > On Wed, 13 Jun 2018 10:29:05 +0200, Michael Schnell via Lazarus > wrote: > >> On 12.06.2018 17:08, Sven Barth via Lazarus wrote: >>> No. Delphi does *not* solve this by using dynamic linking. >> OK. I see. Thanks for pointing this out. >> >> Hence in such a (potentially problematic) case the suggested solution >> might be helpful even with Delphi. >> >> But as Bo's code seemingly works fin with Delphi, hopefully compiling >> the Dongle code into the Lazarus IDE will simply work as expected. >> > > I gave up on having the dongle as part of the IDE since simply > creating the object in application code as needed is OK. It works in > that setting so the OBJ file after conversion to CUFF format seems to > be OK for the application even though Lazarus itself barfs at it. > > Not a real issue enymore. The concept of dropping a component on a > form to use it is coming from when we started using Delphi a long time > ago. > And the non-visual components were dropped on a data module at the > time. I need to use the *same* security dongle in Lazarus. I don't want to change to a different dongle. I'd like a few more details on how to create the object in application code. Any links to other discussion of this issue would be appreciated. Thanks *very* much Bo! From bo.berglund at gmail.com Wed Jul 25 20:40:00 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Wed, 25 Jul 2018 20:40:00 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Wed, 25 Jul 2018 13:07:10 -0400, Paul Breneman via Lazarus wrote: >Thanks for *all* of that info Bo. My favorite time in Sweden (in 1992) >I visited the Vasa. Maybe if I visit again we can meet up? > https://www.vasamuseet.se Yes, that is the top attraction in Stockholm! The museum has been vastly improved since 1992, it is worth a re-visit. Concerning my config app I have checked that the code runs on ARM by building the same sources I use on my Win7 PC also on a RaspberryPi3B. Same FPC and Lazarus versions (3.0.4/1.8.4). No problems there except an annoying display difference, all of the controls on my form were slightly misplaced in RPi3 and the captions used a font that was too big and did not fit the text inside the buttons... Is there a way to ensure that the GUI design stays put when moving about on different target systems? -- Bo Berglund Developer in Sweden From r030t1 at gmail.com Wed Jul 25 20:57:54 2018 From: r030t1 at gmail.com (R0b0t1) Date: Wed, 25 Jul 2018 13:57:54 -0500 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> Message-ID: https://wiki.gentoo.org/wiki/Project:Android On Wed, Jul 25, 2018 at 7:04 AM, Bo Berglund via Lazarus wrote: > I have a GUI program developed in FPC/Lazarus x64 on Windows. > It is an IoT device configuration application which would benefit from > being portable, i.e. executable on an Android phone. The devices in > question will be placed in locations where configuration would be > easier from a phone. > > Before I start digging in to the multiple pages I have found on the > fpc/Android subject I want to ask if it would be feasible to > cross-compile my Windows application for Android phone use? > > I have used standard GUI controls in Lazarus for the visual parts and > Indy10 (via indylaz) for the TCP/IP communications stuff. > > Any advice welcome! > But if it turns out to be a learning path several weeks long it is > probably not worth the effort... > > > -- > Bo Berglund > Developer in Sweden > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From r030t1 at gmail.com Wed Jul 25 20:57:54 2018 From: r030t1 at gmail.com (R0b0t1) Date: Wed, 25 Jul 2018 13:57:54 -0500 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> Message-ID: https://wiki.gentoo.org/wiki/Project:Android On Wed, Jul 25, 2018 at 7:04 AM, Bo Berglund via Lazarus wrote: > I have a GUI program developed in FPC/Lazarus x64 on Windows. > It is an IoT device configuration application which would benefit from > being portable, i.e. executable on an Android phone. The devices in > question will be placed in locations where configuration would be > easier from a phone. > > Before I start digging in to the multiple pages I have found on the > fpc/Android subject I want to ask if it would be feasible to > cross-compile my Windows application for Android phone use? > > I have used standard GUI controls in Lazarus for the visual parts and > Indy10 (via indylaz) for the TCP/IP communications stuff. > > Any advice welcome! > But if it turns out to be a learning path several weeks long it is > probably not worth the effort... > > > -- > Bo Berglund > Developer in Sweden > > -- > _______________________________________________ > Lazarus mailing list > Lazarus at lists.lazarus-ide.org > https://lists.lazarus-ide.org/listinfo/lazarus From bo.berglund at gmail.com Wed Jul 25 22:10:07 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Wed, 25 Jul 2018 22:10:07 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> Message-ID: <94mhldhiot37abmt34mlm4k3ud9atr18h4@4ax.com> On Wed, 25 Jul 2018 13:57:54 -0500, R0b0t1 via Lazarus wrote: >https://wiki.gentoo.org/wiki/Project:Android That page does not contain a single instance of the words "pascal" or "lazarus". Seems like it is a dead end for my question about crosscompiling an *existing* fpc/lazarus application targeting Android on arm (= phones)... -- Bo Berglund Developer in Sweden From aaa5500 at ya.ru Thu Jul 26 00:52:14 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Thu, 26 Jul 2018 01:52:14 +0300 Subject: [Lazarus] Unix Printer Props dlg: empty Margins tab Message-ID: <8ba594df-95d2-a556-9be2-4a20d262e7c8@ya.ru> this tab is a mistake, it is not filled in this dialog. Tiny patch removes it. AFAIK- Unix CUPS don't support margins at all. -- Regards, Alexey -------------- next part -------------- A non-text attachment was scrubbed... Name: del-mr.diff Type: text/x-patch Size: 1458 bytes Desc: not available URL: From r030t1 at gmail.com Thu Jul 26 03:22:49 2018 From: r030t1 at gmail.com (R0b0t1) Date: Wed, 25 Jul 2018 20:22:49 -0500 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <94mhldhiot37abmt34mlm4k3ud9atr18h4@4ax.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <94mhldhiot37abmt34mlm4k3ud9atr18h4@4ax.com> Message-ID: On Wed, Jul 25, 2018 at 3:10 PM, Bo Berglund via Lazarus wrote: > On Wed, 25 Jul 2018 13:57:54 -0500, R0b0t1 via Lazarus > wrote: > >>https://wiki.gentoo.org/wiki/Project:Android > > That page does not contain a single instance of the words "pascal" or > "lazarus". > Seems like it is a dead end for my question about crosscompiling an > *existing* fpc/lazarus application targeting Android on arm (= > phones)... > My apologies, I was a bit confused. Mr. Breneman mentioned compiling for Android from Android in one of his posts. If you really wanted to do that, following the steps on that page is probably the easiest way to accomplish it. Though now I think there are some other distro-unpackers that will run on unrooted phones. Gentoo is probably the best and has the most up-to-date software. If you mean to go from x86[_64] -> Android then I am very interested in the answer to this question. At most I found http://wiki.lazarus.freepascal.org/Android_tutorial some time ago. Cheers, R0b0t1 From r030t1 at gmail.com Thu Jul 26 03:22:49 2018 From: r030t1 at gmail.com (R0b0t1) Date: Wed, 25 Jul 2018 20:22:49 -0500 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: <94mhldhiot37abmt34mlm4k3ud9atr18h4@4ax.com> References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <94mhldhiot37abmt34mlm4k3ud9atr18h4@4ax.com> Message-ID: On Wed, Jul 25, 2018 at 3:10 PM, Bo Berglund via Lazarus wrote: > On Wed, 25 Jul 2018 13:57:54 -0500, R0b0t1 via Lazarus > wrote: > >>https://wiki.gentoo.org/wiki/Project:Android > > That page does not contain a single instance of the words "pascal" or > "lazarus". > Seems like it is a dead end for my question about crosscompiling an > *existing* fpc/lazarus application targeting Android on arm (= > phones)... > My apologies, I was a bit confused. Mr. Breneman mentioned compiling for Android from Android in one of his posts. If you really wanted to do that, following the steps on that page is probably the easiest way to accomplish it. Though now I think there are some other distro-unpackers that will run on unrooted phones. Gentoo is probably the best and has the most up-to-date software. If you mean to go from x86[_64] -> Android then I am very interested in the answer to this question. At most I found http://wiki.lazarus.freepascal.org/Android_tutorial some time ago. Cheers, R0b0t1 From bo.berglund at gmail.com Thu Jul 26 10:02:10 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Thu, 26 Jul 2018 10:02:10 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Wed, 25 Jul 2018 20:40:00 +0200, Bo Berglund via Lazarus wrote: >Concerning my config app I have checked that the code runs on ARM by >building the same sources I use on my Win7 PC also on a RaspberryPi3B. >Same FPC and Lazarus versions (3.0.4/1.8.4). > >No problems there except an annoying display difference, all of the >controls on my form were slightly misplaced in RPi3 and the captions >used a font that was too big and did not fit the text inside the >buttons... I was wrong, there ARE problems! The ported code starts up fine on Raspberry Pi, but as soon as I try to connect a TCP socket connection to the device the program crashes hard. No dialog or anything, it just disappears from sight!!! As I stated I have created the program from scratch on Windows7 using FPC/Lazarus (64 bit version) and on Windows it works just fine. It uses Indy10 for TCP communications. Then I zipped up the sources and put them on the RPi3 box where I have FPC 3.0.4 and Lazarus 1.8.4. Opened the project in Lazarus and compiled and ran the program. So I have NOT edited the code for any Win/Linux differences for example, is that needed? For example in some console apps I have made also for both Windows and Raspbian I have this in the lpr file: {$IFDEF UNIX} {$IFDEF UseCThreads} cthreads, {$ENDIF} {$ENDIF} If that is needed also here, where should it be put? -- Bo Berglund Developer in Sweden From pascaldragon at googlemail.com Thu Jul 26 10:26:27 2018 From: pascaldragon at googlemail.com (Sven Barth) Date: Thu, 26 Jul 2018 10:26:27 +0200 Subject: [Lazarus] Crosscompile to Android on arm? In-Reply-To: References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: Bo Berglund via Lazarus schrieb am Do., 26. Juli 2018, 10:02: > Then I zipped up the sources and put them on the RPi3 box where I have > FPC 3.0.4 and Lazarus 1.8.4. > Opened the project in Lazarus and compiled and ran the program. > Did you run it from inside Lazarus? Thus with the debugger? That might help you find the problem. > So I have NOT edited the code for any Win/Linux differences for > example, is that needed? > Maybe, depending on your program. > > For example in some console apps I have made also for both Windows and > Raspbian I have this in the lpr file: > {$IFDEF UNIX} > {$IFDEF UseCThreads} > cthreads, > {$ENDIF} > {$ENDIF} > > If that is needed also here, where should it be put? > Also in the main project file in front of any other units. If your program indeed uses threads (don't know whether Indy uses them) then you'll also either need to add UseCThreads to the project defines or remove the "$ifdef UseCThreads" so that the cthreads unit is always used on Unix-like systems. Regards, Sven > -------------- next part -------------- An HTML attachment was scrubbed... URL: From juha.manninen62 at gmail.com Thu Jul 26 10:56:16 2018 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Thu, 26 Jul 2018 11:56:16 +0300 Subject: [Lazarus] Unix Printer Props dlg: empty Margins tab In-Reply-To: <8ba594df-95d2-a556-9be2-4a20d262e7c8@ya.ru> References: <8ba594df-95d2-a556-9be2-4a20d262e7c8@ya.ru> Message-ID: On Thu, Jul 26, 2018 at 1:52 AM AlexeyT via Lazarus wrote: > this tab is a mistake, it is not filled in this dialog. Tiny patch > removes it. AFAIK- Unix CUPS don't support margins at all. I applied the patch in r58637. Thanks. Juha From aaa5500 at ya.ru Thu Jul 26 11:51:28 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Thu, 26 Jul 2018 12:51:28 +0300 Subject: [Lazarus] Unix Select Printer dlg: tab-order fix Message-ID: <67e66bac-e7ff-b3c8-18da-f8be07c4a41c@ya.ru> this fixes weird tab-order. -- Regards, Alexey -------------- next part -------------- A non-text attachment was scrubbed... Name: selpri.diff Type: text/x-patch Size: 3886 bytes Desc: not available URL: From aaa5500 at ya.ru Thu Jul 26 12:18:09 2018 From: aaa5500 at ya.ru (AlexeyT) Date: Thu, 26 Jul 2018 13:18:09 +0300 Subject: [Lazarus] Unix Select Printer dlg: fix i18n Message-ID: some more work needed for i18n, seems, for captions of controls. maybe Maxim can help? this is for string consts in form. -- Regards, Alexey -------------- next part -------------- A non-text attachment was scrubbed... Name: int.diff Type: text/x-patch Size: 2598 bytes Desc: not available URL: From bo.berglund at gmail.com Fri Jul 27 08:21:56 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 27 Jul 2018 08:21:56 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Thu, 26 Jul 2018 10:26:27 +0200, Sven Barth via Lazarus wrote: >> For example in some console apps I have made also for both Windows and >> Raspbian I have this in the lpr file: >> {$IFDEF UNIX} >> {$IFDEF UseCThreads} >> cthreads, >> {$ENDIF} >> {$ENDIF} >> >> If that is needed also here, where should it be put? >> > >Also in the main project file in front of any other units. If your program >indeed uses threads (don't know whether Indy uses them) then you'll also >either need to add UseCThreads to the project defines or remove the "$ifdef >UseCThreads" so that the cthreads unit is always used on Unix-like systems. Indy does use threads extensively... Since I could not find any place to set a project wide defined symbol UseCThreads I did this instead in the lpr file: program WiFiConfig; {$mode objfpc}{$H+} uses {$IFDEF UNIX} cthreads, {$ENDIF} Interfaces, // this includes the LCL widgetset Forms, indylaz, FormMainConfig, wificommhandler { you can add units after this }; {$R *.res} begin RequireDerivedFormResource := True; Application.Initialize; Application.CreateForm(TfrmMainConfig, frmMainConfig); Application.Run; end. After this the program does no longer crashes when I try to connect to the device, but it does not connect either because I am having problems making OpenVPN to the network where the device lives work from the RPi box. I have to solve this somehow, it works fine from my Windows7 PC so there I can interact with the device. Problem for another forum, though. -- Bo Berglund Developer in Sweden From bo.berglund at gmail.com Fri Jul 27 08:36:32 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 27 Jul 2018 08:36:32 +0200 Subject: [Lazarus] Using a component OBJ file in Lazarus? References: <6deffba1-5d93-0eb9-93c5-0b273ebf9823@lumino.de> <96f49d4e-ef4a-7175-e5e0-9ae004d41db1@lumino.de> <975d5a43-e2c6-a01f-9311-1d74ee9cdbb5@BrenemanLabs.com> Message-ID: On Wed, 25 Jul 2018 13:31:08 -0400, Paul Breneman via Lazarus wrote: >I need to use the *same* security dongle in Lazarus. I don't want to >change to a different dongle. Since Safenet does not provide any new OBJ file n´than the one fpc cannot use the only path seems to be to somehow convert it using objconv. But I have not yet succeeded and have given up because even if it would be successful the solution relies on a vendor specific driver for the operating system it will run on. And we have had lots of problems over the years with their dongle driver for Windows. >I'd like a few more details on how to create the object in application code. Simple: var MyDongle: TMyDongleType; begin MyDongle := TMyDongleType(NIL); try ....use the dongle functions.... finally MyDongle.Free; end; end; You can also declare the dongle variable in global scope and use it in more places. The NIL argument is needed if the dongle is defined as a component descendant since it has an owner: type TMyDongle = class(TComponent); -- Bo Berglund Developer in Sweden From juha.manninen62 at gmail.com Fri Jul 27 12:29:03 2018 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Fri, 27 Jul 2018 13:29:03 +0300 Subject: [Lazarus] Unix Select Printer dlg: tab-order fix In-Reply-To: <67e66bac-e7ff-b3c8-18da-f8be07c4a41c@ya.ru> References: <67e66bac-e7ff-b3c8-18da-f8be07c4a41c@ya.ru> Message-ID: On Thu, Jul 26, 2018 at 12:52 PM AlexeyT via Lazarus wrote: > this fixes weird tab-order. I applied this one in r58640. Thanks. I leave the i18n patch for Maxim. Juha From ganmax at narod.ru Fri Jul 27 13:22:27 2018 From: ganmax at narod.ru (Maxim Ganetsky) Date: Fri, 27 Jul 2018 14:22:27 +0300 Subject: [Lazarus] Unix Select Printer dlg: tab-order fix In-Reply-To: References: <67e66bac-e7ff-b3c8-18da-f8be07c4a41c@ya.ru> Message-ID: <3cb074d0-f8ad-00f6-7863-9f0dfb8f618a@narod.ru> 27.07.2018 13:29, Juha Manninen via Lazarus пишет: > On Thu, Jul 26, 2018 at 12:52 PM AlexeyT via Lazarus > wrote: >> this fixes weird tab-order. > > I applied this one in r58640. Thanks. > I leave the i18n patch for Maxim. The patch looks good, please apply it too. -- Best regards, Maxim Ganetsky mailto:ganmax at narod.ru From list2010 at BrenemanLabs.com Fri Jul 27 18:58:08 2018 From: list2010 at BrenemanLabs.com (Paul Breneman) Date: Fri, 27 Jul 2018 12:58:08 -0400 Subject: [Lazarus] Using a component OBJ file in Lazarus? In-Reply-To: References: <6deffba1-5d93-0eb9-93c5-0b273ebf9823@lumino.de> <96f49d4e-ef4a-7175-e5e0-9ae004d41db1@lumino.de> <975d5a43-e2c6-a01f-9311-1d74ee9cdbb5@BrenemanLabs.com> Message-ID: On 07/27/2018 02:36 AM, Bo Berglund via Lazarus wrote: ... > And we have had lots of problems over the years with their dongle > driver for Windows. Thankfully we've not experienced that. Thanks Bo for your comments! Regards, Paul www.ControlPascal.com From bo.berglund at gmail.com Fri Jul 27 19:58:07 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Fri, 27 Jul 2018 19:58:07 +0200 Subject: [Lazarus] Crosscompile to Android on arm? References: <6epgldhbjd06oqtqs12bb1q8n0n7r28jie@4ax.com> <661b4ee8-26b2-433e-21e4-f27f8e3835c0@BrenemanLabs.com> Message-ID: On Fri, 27 Jul 2018 08:21:56 +0200, Bo Berglund via Lazarus wrote: >After this the program does no longer crashes when I try to connect to >the device, but it does not connect either because I am having >problems making OpenVPN to the network where the device lives work >from the RPi box. >I have to solve this somehow, it works fine from my Windows7 PC so >there I can interact with the device. >Problem for another forum, though. Worked around it by copying the executable from my local RPi to another RPi unit running at home using FileZilla on my Win7 laptop. Then started it in a VNC window on tghe RPI back home. In this case the application works just fine to connect to the ESP8277 device and retrieve the config data! :) So I am back to my original enquiry: Can I also cross-compile this application to run as an app on an Android phone or tablet? If it is possible, exactly how can it be done? -- Bo Berglund Developer in Sweden From juha.manninen62 at gmail.com Fri Jul 27 20:29:00 2018 From: juha.manninen62 at gmail.com (Juha Manninen) Date: Fri, 27 Jul 2018 21:29:00 +0300 Subject: [Lazarus] Unix Select Printer dlg: tab-order fix In-Reply-To: <3cb074d0-f8ad-00f6-7863-9f0dfb8f618a@narod.ru> References: <67e66bac-e7ff-b3c8-18da-f8be07c4a41c@ya.ru> <3cb074d0-f8ad-00f6-7863-9f0dfb8f618a@narod.ru> Message-ID: On Fri, Jul 27, 2018 at 2:22 PM Maxim Ganetsky via Lazarus wrote: > The patch looks good, please apply it too. Ok, applied in r58641. Juha From michael at freepascal.org Sat Jul 28 15:05:31 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sat, 28 Jul 2018 15:05:31 +0200 (CEST) Subject: [Lazarus] Printer printable width&height Message-ID: Hi, The selectprinter demo prints a kind of test page. However, on linux the rectangle it draws on the page seems to be off. The left margin seems to be about right, but the bottom and top margins fall off the page. If I try to code something myself, I would code it like this: procedure TMainForm.GetPageRect(Out PageRect : TRect); Function ToPixels(aUnit,ares : Integer) : Integer; begin if PSDemo.Units in [pmDefault,pmMillimeters] then // 1/1000 of a mm Result:=Round(((aUnit div 1000) / 25.4) * Ares) else Result:=aUnit * Ares end; Var LM,RM,TM,BM,H,W : Integer; begin H:=Printer.PaperSize.Height; W:=Printer.PaperSize.Width; LM:=ToPixels(PSDemo.MarginLeft,Printer.XDPI); RM:=ToPixels(PSDemo.MarginRight,Printer.XDPI); TM:=ToPixels(PSDemo.MarginLeft,Printer.YDPI); BM:=ToPixels(PSDemo.MarginBottom,Printer.YDPI); PageRect:=Rect(LM,TM,W-RM,H-BM); end; PSDemo is a TPageSetupDialog. The values displayed by the lazarus test program match more or less what my code gets. Similarly, if I draw a rectangle with the rectangle defined as above, the bottom-right falls off the page. So the question is: what is the origin of the printer canvas ? Top-left corner of the paper (What it should be IMO ?) Or is it the Top-left corner of the printable area of the page ? How to obtain the origin of the printable area ? Is the PageWidth/Pageheight relative to this origin ? Or is there something else wrong in the printer class or the demo code ? (using GTK2, 64-bit) Michael. From mailinglists at geldenhuys.co.uk Sat Jul 28 19:52:21 2018 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sat, 28 Jul 2018 18:52:21 +0100 Subject: [Lazarus] Printer printable width&height In-Reply-To: References: Message-ID: On 28/07/18 14:05, Michael Van Canneyt via Lazarus wrote: > How to obtain the origin of the printable area ? > Is the PageWidth/Pageheight relative to this origin ? As far as I know (or how I always understood print drivers), the PageWidth and PageHeight is the full page size (eg: A4 = 210x297mm). The printable area is printer dependent. eg: my laser printer can't print in a 5mm border around the page. Yet my inkjet printer can print full page size. Same software was used to test this. 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 Sun Jul 29 10:50:35 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Sun, 29 Jul 2018 10:50:35 +0200 (CEST) Subject: [Lazarus] Printer printable width&height In-Reply-To: References: Message-ID: On Sat, 28 Jul 2018, Graeme Geldenhuys via Lazarus wrote: > On 28/07/18 14:05, Michael Van Canneyt via Lazarus wrote: >> How to obtain the origin of the printable area ? >> Is the PageWidth/Pageheight relative to this origin ? > > As far as I know (or how I always understood print drivers), the > PageWidth and PageHeight is the full page size (eg: A4 = 210x297mm). No, as far as I can see, this is paperwidth and papersize. > > The printable area is printer dependent. eg: my laser printer can't > print in a 5mm border around the page. Yet my inkjet printer can print > full page size. Same software was used to test this. I know this, and it looks like this is why PageWidth and PageHeight were introduced. But without knowing what the origin of this pagewidth&pagesize is, these are useless properties. I must now resort to trial and error to draw a rectangle with sides at equal distances from the paper borders. e.g. 1 cm from the paper edges. The 'logical' choices (as also used in the selectprinter demo) do not seem to work. Michael. From md at delfire.net Sun Jul 29 14:27:17 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Sun, 29 Jul 2018 09:27:17 -0300 Subject: [Lazarus] Indy vs Synopse: POP3 Message-ID: I need to read e-mails in a few accounts using POP3. I haven't use Indy for years, but I've installed the version 10 in Lazarus 1.9 (trunk) using FPC 3.1.1. It seems that things changed like SASLMechanism, which does't work when I click in the button to open the editor, showing me this error: TGlyphBitmap: Unsupported Resourcetype: XPM Resource Name: DIS_ARROWRIGHT But maybe this property can be set directly to the code... anyway. Do you have a simple demo (I haven't found any about it) that show how connect in a Google account, using POP3? Is there any dependencies as dlls? As Indy looks like has a "new mechanism" to authentication, I'm thinking if Synopse still work for that job. If Indy has no dependencies, I would like to use it. I believe Synopse has SSL dependencies... I don't know. Have you already compare both frameworks? Wich one should I choose for this job? best regards, Marcos Douglas -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglists at geldenhuys.co.uk Sun Jul 29 21:57:01 2018 From: mailinglists at geldenhuys.co.uk (Graeme Geldenhuys) Date: Sun, 29 Jul 2018 20:57:01 +0100 Subject: [Lazarus] Indy vs Synopse: POP3 In-Reply-To: References: Message-ID: <3474d024-66ee-f4b6-7e42-19e107f47ece@geldenhuys.co.uk> On 29/07/18 13:27, Marcos Douglas B. Santos via Lazarus wrote: > As Indy looks like has a "new mechanism" to authentication, I'm thinking if > Synopse still work for that job. If Indy has no dependencies, I would like > to use it. I believe Synopse has SSL dependencies... I don't know. > > Have you already compare both frameworks? Wich one should I choose for this > job? First off, this is the wrong list to ask these questions. Indy has its own dedicated support newsgroups and web forums (listed on their website). They are active and your questions will be answered very quickly. You can also search existing questions (the newsgroups have a larger history that the web forums as far as I know). So you'll probably find your answers just by doing that. I've used both Synapse and Indy in the past. I preferred the interfaces that Indy components supplied. Indy also has a ton of working examples for pretty much every component they supply. StackExchange also has loads of Indy support questions and answers. 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 bo.berglund at gmail.com Mon Jul 30 14:10:27 2018 From: bo.berglund at gmail.com (Bo Berglund) Date: Mon, 30 Jul 2018 14:10:27 +0200 Subject: [Lazarus] Indy vs Synopse: POP3 References: Message-ID: <9kvtldtii0rpf6c6avcov0bbg73fd05oj4@4ax.com> On Sun, 29 Jul 2018 09:27:17 -0300, "Marcos Douglas B. Santos via Lazarus" wrote: >I haven't use Indy for years, but I've installed the version 10 in Lazarus >1.9 (trunk) using FPC 3.1.1. How did you install it? Did you use the Package/OnLinePackageManager to get it thus ensuring the most recent and working version of Indy? Regarding GMail, I have used Indy10 to read mail on Gmail via Pop3, but you need to use the encrypted connection just like if you would connect to GMail from for example Thunderbird. The SSL handlers are available as open source and integrated with Indy. Works fine. As Graeme has already suggested you should use the Indy specific forum for questions regarding Indy in Delphi and FPC environments: https://www.atozed.com/forums/forumdisplay.php?fid=9 -- Bo Berglund Developer in Sweden From md at delfire.net Mon Jul 30 14:30:35 2018 From: md at delfire.net (Marcos Douglas B. Santos) Date: Mon, 30 Jul 2018 09:30:35 -0300 Subject: [Lazarus] Indy vs Synopse: POP3 In-Reply-To: <9kvtldtii0rpf6c6avcov0bbg73fd05oj4@4ax.com> References: <9kvtldtii0rpf6c6avcov0bbg73fd05oj4@4ax.com> Message-ID: On Mon, Jul 30, 2018 at 9:10 AM, Bo Berglund via Lazarus wrote: > > On Sun, 29 Jul 2018 09:27:17 -0300, "Marcos Douglas B. Santos via > Lazarus" wrote: > > >I haven't use Indy for years, but I've installed the version 10 in Lazarus > >1.9 (trunk) using FPC 3.1.1. > > How did you install it? > Did you use the Package/OnLinePackageManager to get it thus ensuring > the most recent and working version of Indy? I've got from trunk, manually installed. > Regarding GMail, I have used Indy10 to read mail on Gmail via Pop3, > but you need to use the encrypted connection just like if you would > connect to GMail from for example Thunderbird. > The SSL handlers are available as open source and integrated with > Indy. Works fine. Do you use SASLMechanism ? Could you send an example, please? You can send to my inbox if this kind of subject bother you on that list too. > As Graeme has already suggested you should use the Indy specific forum > for questions regarding Indy in Delphi and FPC environments: > > https://www.atozed.com/forums/forumdisplay.php?fid=9 Thanks for the link. regards, Marcos Douglas From michael at freepascal.org Tue Jul 31 09:17:27 2018 From: michael at freepascal.org (Michael Van Canneyt) Date: Tue, 31 Jul 2018 09:17:27 +0200 (CEST) Subject: [Lazarus] Code tools anomaly Message-ID: Hi, On Linux, GTK 2, using fpc trunk, lazarus trunk: Open unit packages/fcl-net/src/ssockets.pp Code tools do not work. Reason can be detected as follows: Ctrl-Click sockets unit in interface uses clause. Lazarus opens the sockets unit in rtl-extra/src/amiga (!?) All code completion is nroken in the ssockets unit, because lazarus chokes on functions in the amiga unit like: function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall SocketBase 30; 1/ Seems like the heuristics for opening units needs a tweak. 2/ Probably the amiga OS devs would be happy to see support for location 'x' as well since it would enable code completion. Michael.