Re: [fpc-pascal] Type-casting a class variable

2024-05-01 Thread Jean SUZINEAU via fpc-pascal
I didn't tested but I imagine it could be done with something like this ? type    TWindow_Class= class of TWindow; begin   ...   (myClass as TWindow_Class).CreateNewWindow( ); ___ fpc-pascal maillist -

Re: [fpc-pascal] Floating point question

2024-02-22 Thread Jean SUZINEAU via fpc-pascal
I see that Wikipedia is not very clear on this,  you just find "x86" mentioned, but for Pascal: "this Extended type is available on 16, 32 and 64-bit platforms, possibly with padding" https://en.wikipedia.org/wiki/Extended_precision ___ fpc-pascal

Re: [fpc-pascal] Floating point question

2024-02-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/02/2024 à 15:08, Thomas Kurz via fpc-pascal a écrit : But it's supported on Linux but not on Windows? Huh? As far as I know Extended is not supported on Linux.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Floating point question

2024-02-09 Thread Jean SUZINEAU via fpc-pascal
Le 09/02/2024 à 20:53, Jonas Maebe via fpc-pascal a écrit : However, adding support for an option called -CFMax or similar should be no problem. It would be very nice to compile old code ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Floating point question

2024-02-06 Thread Jean SUZINEAU via fpc-pascal
I've just made a small test with the old Borland Delphi 7.0 build 4453 from 2002 : ... type TForm1 = class(TForm) m: TMemo; procedure FormCreate(Sender: TObject); end; ... procedure TForm1.FormCreate(Sender: TObject); var    GG: Extended;    S: String; begin GG :=

Re: [fpc-pascal] What's in Hello World

2024-01-08 Thread Jean SUZINEAU via fpc-pascal
Le 08/01/2024 à 13:51, Peter B via fpc-pascal a écrit :    or if not, is there another way to turn it on in the textmode IDE? No idea. Its easy enough if you compile from the command line. fpc -Os -XX hello.pas If stripping is not on by default, also use -Xs I guess that in the textmode IDE

Re: [fpc-pascal] Labels

2023-12-18 Thread Jean SUZINEAU via fpc-pascal
Le 17/12/2023 à 17:47, Adriaan van Os via fpc-pascal a écrit : Turbo Pascal (5.5) defines label = digit-sequence . Are you sure ? I had a doubt and I had a look in some very old source code from 1990 made with tp 5.5, it seems you could have letters in labels. Excerpt of the code:

Re: [fpc-pascal] case statement

2023-12-15 Thread Jean SUZINEAU via fpc-pascal
Le 15/12/2023 à 10:39, Adriaan van Os via fpc-pascal a écrit : I don't see a semicolon in the formal syntax. May be included in the ' "DO" statement ' ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Jean SUZINEAU via fpc-pascal
It sounds like "SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and then SpVoice is nil ? May be try with an OleVariant instead of a simple Variant ? (i.e declare var SpVoice: OleVariant; ) ___ fpc-pascal maillist -

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Jean SUZINEAU via fpc-pascal
Le 17/06/2023 à 20:07, Travis Siegel via fpc-pascal a écrit : Is this a relatively new addition to fpc or something? I 've just found it in my Delphi 7 code (and code very likely written for Delphi 4), so I think it's there since at least 2000-2001 ... May be it appeared with Delphi 1 ?

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-13 Thread Jean SUZINEAU via fpc-pascal
Le 12/06/2023 à 19:05, Steve Litt via fpc-pascal a écrit : Busted! I used Pascal 1984-1993 So I guess you are not familiar too with the "Result" variable which appeared with Delphi 1 in 1995 if I remember correctly. nextt:= num; can be written to as : Result:= num;

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Jean SUZINEAU via fpc-pascal
According to you other posts, I won't be surprised that you think in a C/C++ way. This doesn't change anything in your last example, but particularly  : nextt := num; doesn't behave like in C : return num; In pascal I think the equivalent would be : nextt := num; exit;

Re: [fpc-pascal] Function to create a record ?

2023-06-05 Thread Jean SUZINEAU via fpc-pascal
Oops, I hit "Send message" too quickly. The only difference in the second code is: - personrecord renamed to personclass and declared as "personclass = class" - "newp:= personclass.Create;" added in function newperson Of course for a clean code, you'll need to call something like

Re: [fpc-pascal] Function to create a record ?

2023-06-05 Thread Jean SUZINEAU via fpc-pascal
Hello, I have a hard time trying to understand what you want to test. In your functions, you are using a record, not a class or a pointer to record or an object. The personrecord just behave in your parameters and return value as an Integer or a String, and your fillchar doesn't write

Re: [fpc-pascal] Why does RunCommand not produce the correct output?

2023-05-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/05/2023 à 17:00, Bo Berglund via fpc-pascal a écrit : I have created a shellscript with the same command string May be running directly your script in bash: RunCommand('/bin/bash', ['your_script.sh' ], OutData) ___ fpc-pascal maillist -

Re: [fpc-pascal] Why does RunCommand not produce the correct output?

2023-05-01 Thread Jean SUZINEAU via fpc-pascal
I don't have an example at hand but I think you should run a bash interpreter, something like : RunCommand('/bin/bash', ['-c', ListCmd], OutData) but I'm not 100% sure. There is a good documentation at: https://wiki.freepascal.org/Executing_External_Programs May be you need to split your

Re: [fpc-pascal] Pause Key

2023-04-14 Thread Jean SUZINEAU via fpc-pascal
... I wouldn't be surprised that James's program is a console one, not using TForm nor any windows message loop to process WM_ messages, but I may be wrong. It can be more tricky in this case. ___ fpc-pascal maillist -

Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-05 Thread Jean SUZINEAU via fpc-pascal
May be you could get the source code of i2ctransfer from i2c-tools and compare it with the code in i2c.pas ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Jean SUZINEAU via fpc-pascal
I couldn't verify the code but it should be  relatively close to your  c++ example. Not sure of the width of int type, I supposed it's 16 bits wide: function CRC16( crc: Word; buf: PByte; len: Word; Poly:Word=$A001): Word; var    pos: Word;    i: Word; begin for pos:= 0 to len-1 do   

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-24 Thread Jean SUZINEAU via fpc-pascal
If your main program is a console program, it's likely that you'll need to call CheckSynchronize( from unit Class) in your main program/main thread from time to time in order to allow the execution of calls of methods specified in Synchronize in your thread (which reads mqtt messages). I'm

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-24 Thread Jean SUZINEAU via fpc-pascal
Le 23/10/2022 à 23:59, Bo Berglund via fpc-pascal a écrit : Might get stuck at readln(s) if no messages are sent, i.e. no carriage-return coming along? AFAIK readln is blocking, right? I've made a test with mosquitto_pub, it seems there is a line ending at the end of each message, so you will

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-23 Thread Jean SUZINEAU via fpc-pascal
Le 23/10/2022 à 22:50, Jean SUZINEAU via fpc-pascal a écrit : This way you'll receive the output of mosquitto_sub on the standard input of SomePascalProgram. A very small example for SomePascalProgram for  use with pipe, reading on standard input and writing on standard output : var    s

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-23 Thread Jean SUZINEAU via fpc-pascal
May be with a pipe |  ? Something like mosquitto_sub -h 192.168.117.131 -F '@Y-@m-@d @H:@M:@S ; %t ; %p' -t '#' | SomePascalProgram This way you'll receive the output of mosquitto_sub on the standard input of SomePascalProgram. I've tested locally on an Apache log with    tail -f

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/10/2022 à 23:37, Bo Berglund via fpc-pascal a écrit : If I could get at each output that mosquitto_cli writes into a script or such then I would be good to go. Maybe with a redirection ( > ) to a file in bash ? ___ fpc-pascal maillist -

Re: [fpc-pascal] mciSendString with long file names

2022-09-20 Thread Jean SUZINEAU via fpc-pascal
May be by escaping the spaces with ^ ? Something like:  MyFileName:= StringReplace(MyFileName, ' ', '^ ', [rfReplaceAll]); ^ is the escape char for cmd.exe but may be it is active in this context too ? Le 20/09/2022 à 18:31, James Richters via fpc-pascal a écrit : I just tried it that

Re: [fpc-pascal] Get highest element of a StringList

2022-09-12 Thread Jean SUZINEAU via fpc-pascal
As Bart suggested, you can use too the for/in loop:  for s in sl do WriteLn( s); For example: var    sl: TStringList;    s: String; begin sl:= TStringList.Create; try     sl.Add('1');     sl.Add('2');     for s in sl do WriteLn( s); finally     FreeAndNil(

Re: [fpc-pascal] I am offering a $100 reward for linking static libraries

2022-09-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/09/2022 à 07:50, Michael Van Canneyt via fpc-pascal a écrit : The file seems corrupt. I tried several programs, none managed to open it. Indeed more than corrupt. For me, file is just empty (size 0 byte) ___ fpc-pascal maillist -

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Jean SUZINEAU via fpc-pascal
Le 29/08/2022 à 01:41, James Richters via fpc-pascal a écrit : If a special function is needed for some COM thing or weird Winapi thing, then that function should be part of the unit that needs it, not modifying the generic function intended to be used for general purpose applications output

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
An if you eventually need a read only UnionField :  TmByte= packed array[0..7] of Byte;  TDataExample2  =   record     internal     : record    case integer    of 0: (mData: Int64); 1: (mByte: TmByte); end;    property mByte : TmByte read internal.mByte;   

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
May the solution to your problem should be just :  TDataExample  =   record     case integer     of   0: (mData: Int64);   1: (mByte: packed array[0..7] of Byte);   2: (UnionField: Int64);   end; ? You aren't going to define a getter or setter method on your property, just an

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
For this particular error I think you should just follow the advice of compiler in the error message : Le 14/08/2022 à 11:49, Skybuck Flying via fpc-pascal a écrit : // normal/standard property property StandardField : integer read mStandardField write mStandardField;

Re: [fpc-pascal] FPC and WebAssembly

2021-12-24 Thread Jean SUZINEAU via fpc-pascal
Wonderful ! Thank you very much for all your work and all the work of the FPC / Lazarus team ! And Merry Christmas for all ! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?

2021-10-05 Thread Jean SUZINEAU via fpc-pascal
I don't know if it's related, but I experienced a similar problem a few years ago. It's a console dll written in Freepascal and compiled for Win64 and Linux (Ubuntu). It uses several threads and uses CheckSynchronize to make calls in the main thread. The dll is loaded and used by a 4gl

Re: [fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-03 Thread Jean SUZINEAU via fpc-pascal
I made a few tests on Ubuntu 64 bits (arch x86_64) with variations on a small test program: var    E2: Byte= 3;    E1: LongWord= 1;    E: QWord; begin E:= (1000*E1) shl E2; writeln( 'E2', E2); writeln( 'E1', E1); writeln( 'E', E); end. In the assembly window, shl is computed

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-30 Thread Jean SUZINEAU via fpc-pascal
I've forgotten to add the link to "Snap!" manual: https://snap.berkeley.edu/snap/help/SnapManual.pdf ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-30 Thread Jean SUZINEAU via fpc-pascal
May be something like "Snap!" ? https://snap.berkeley.edu/snap/snap.html#present:Username=trev1315=plane%202 https://snap.berkeley.edu/project?user=trev1315=plane%202 On my own, I think starting with Lazarus and GUI apps would be far easier. If you create a new app from a template, you can

Re: [fpc-pascal] Explicit Interface implementation and inheritance

2021-08-15 Thread Jean SUZINEAU via fpc-pascal
Ooops, may be I hit reply too fast. It looks like when you write " TObjB = class(TObjA, IBBB)" you just implement IAAA twice. If you comment out IBBB   TImpB = class(TImpA{, IBBB})   public     procedure CallOfB;     //procedure IBBB.MethodB = CallOfB;   end; then the "No matching

Re: [fpc-pascal] Explicit Interface implementation and inheritance

2021-08-14 Thread Jean SUZINEAU via fpc-pascal
Le 15/08/2021 à 00:43, Dmitry Boyarintsev via fpc-pascal a écrit : Why is interface implementation not inherited, if explicit implementation is used. I guess this is because you can implement an interface through delegation too: https://www.freepascal.org/docs-html/ref/refse48.html type   

Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-20 Thread Jean SUZINEAU via fpc-pascal
Le 21/06/2021 à 03:04, James Richters a écrit : Var     ... DefaulSaveAsFileName: Ansistring; SaveAsFileNameBuffer: array[0..Max_Path+1] of char;    ... Begin DefaulSaveAsFileName := 'X:\Something with a really really really long long long long file name to see if there is still a bug with

Re: [fpc-pascal] How to check if a network is available?

2021-06-20 Thread Jean SUZINEAU via fpc-pascal
Ping uses ICMP protocol. I don't have currently Indy installed on my machines, but I think you can find pascal components for ICMP client and even ICMP server. I think that this way you can do a single "ping", a single ICMP request. It seems that Synapse has ping  support too:

Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-19 Thread Jean SUZINEAU via fpc-pascal
I think you should have a look at this documentation on strings, particularly for PChar : https://www.freepascal.org/docs-html/ref/refsu9.html Le 20/06/2021 à 02:09, James Richters a écrit : DefaultFileName: AnsiString = '' ; So Length(DefaultFileName) = 0 TFileName.nMaxFile:=Max_Path+1;

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-19 Thread Jean SUZINEAU via fpc-pascal
Le 19/06/2021 à 15:40, Bo Berglund via fpc-pascal a écrit : function _2d( _i: Integer): String; Strange name of a function, though, is that needed? No, it's not needed, it's just my odd way of naming ... ;-)  (the closer to %.2d ). ___ fpc-pascal

Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-19 Thread Jean SUZINEAU via fpc-pascal
It's curious, I'm not completely sure we are reasoning about the same function and record. You mention TFileName but for me in FPC 3.2.0: -  TFileName is declared as "TFileName= type string;" in sysutilh.inc. - OPENFILENAMEA is declared as record in CommDlg.pp line 94   and

Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
I haven't seen your reply. Le 18/06/2021 à 23:50, James Richters via fpc-pascal a écrit : So now I have: TFileName.nMaxFile:= Length(DefaultFileName)+1; TFileName.lpstrFile:=Pchar(DefaultFileName); I need the +1 for the #0 at the end of the Pchar, and now it works fine, and I can have

Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
I'm not familiar with GetSaveFileNameA, but usually for the size of a FileName  buffer I use the constant MAX_PATH which is defined in unit SysUtils. MAX_PATH itself seems to be an alias from system unit where it is defined accordingly to the operating system (260 on windows, 4096 on Linux,

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
Ooops... little overflow bug My computer has reached 33 days of uptime today and with var     t, d, h, m, s: Integer; you switch to the negative side ... I got a display like : -8:-4:-52 Replacing with QWord solved the problem (I imagine DWord would just allow for something like 66 days) var

Re: [fpc-pascal] How to check if a network is available?

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
Le 18/06/2021 à 17:07, Bo Berglund via fpc-pascal a écrit : I will need to check this in my connector class, the address to look for has to be a config item in my application so it can be modified if need be without rebuilding the app. Have to figure out how to: - Retrieve the output of the

Re: [fpc-pascal] How to check if a network is available?

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
I've never used open vpn, may be the 10.117 is defined in your configuration file ? For the vpns I've used, the ip adressed were fixed. ( for route, you can type too something like "route print 10.117.*" ) ___ fpc-pascal maillist -

Re: [fpc-pascal] How to check if a network is available?

2021-06-18 Thread Jean SUZINEAU via fpc-pascal
May be you can get some information with the "route" command . If you run "route print" in cmd command prompt, you can get information on the different networks available. https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008 (I couldn't find the doc

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-17 Thread Jean SUZINEAU via fpc-pascal
10 kb of Powerbasic ... you're cheating, it's pascal here ;-) You can do this with just 1kb of PowerShell ... ( may be Pascal script could even be shorter ...) File uptime.ps1 : $MethodDefinition = @" [DllImport("kernel32")] public extern static UInt64 GetTickCount64(); "@ $Kernel32 = Add-Type

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-16 Thread Jean SUZINEAU via fpc-pascal
My best score is 67 kb after strip -s with the code below ... ;-) Of course it will not work on every  version of Windows. program uptime; function GetTickCount64: QWord; stdcall; external 'kernel32.dll'; function _2d( _i: Integer): String; begin Str( _i, Result); if Length(Result)

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Jean SUZINEAU via fpc-pascal
I just add a small program to illustrate the type cast between signed and unsigned: var    si: ShortInt; begin si:= -127; WriteLn( 'si ', si); WriteLn( 'Byte(si) ', Byte(si)); si:= -1; WriteLn( 'si ', si); WriteLn( 'Byte(si) ', Byte(si)); end. gives $ ./project1

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Jean SUZINEAU via fpc-pascal
Le 16/06/2021 à 00:31, James Richters via fpc-pascal a écrit : In order to change the value I want to change, I need to run my program as administrator, is there a way to change to administrator with a request from within the program? I guess I could make just a small program that changes the

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Jean SUZINEAU via fpc-pascal
Le 16/06/2021 à 00:31, James Richters via fpc-pascal a écrit : Thanks for the help, it's working fine using readinteger I guess as long as I don't have any values large enough to need the most significant digit that would work... I guess that what was meaning Bart by hardcat is that you

Re: [fpc-pascal] TRegistry documentation

2021-06-15 Thread Jean SUZINEAU via fpc-pascal
In Lazarus , in your source code, you can can "Ctrl + Click" on Registry.ReadString and it will bring you to the declaration of TRegistry.ReadString in unit Registry. There you will find there are other methods like ReadInteger, ReadInt64, ReadBinaryData. I'm not sure which one will best match

Re: [fpc-pascal] Remove last character from pchar

2021-06-10 Thread Jean SUZINEAU via fpc-pascal
Note: if your string is UTF8 encoded, the last "character" can be encoded, can span over 1 to 4 "Char", you need to know the length of your character. For example: program Project1; {$mode objfpc}{$H+} uses   SysUtils, Classes; var    s: array[0..30] of char;    p: PChar;    i: Integer;

Re: [fpc-pascal] Remove last character from pchar

2021-06-10 Thread Jean SUZINEAU via fpc-pascal
I think you could just manage the end of your string with a #0 char. Just allocate enough space for the maximum size of your string plus the terminal #0 char. For example program Project1; {$mode objfpc}{$H+} uses   SysUtils, Classes; var    s: array[0..30] of char;    p: PChar; begin

Re: [fpc-pascal] Directory Tree

2021-05-13 Thread Jean SUZINEAU via fpc-pascal
Le 04/05/2021 à 01:55, James Richters via fpc-pascal a écrit : I’ve been noticing odd behavior in Lazarus.. if I stop the program and modify the form, then hit the green arrow… none of my for modifications are shown.. it’s still using the old form.. but if I use the pull down menus to build

Re: [fpc-pascal] Dependency of OpenSSL 1.0.2 still in FPC 3.2.0 on some platforms?

2021-05-12 Thread Jean SUZINEAU via fpc-pascal
My code uses others units from this directories: https://github.com/jsuzineau/pascal_o_r_mapping/tree/master/pascal_o_r_mapping/2_Units https://github.com/jsuzineau/pascal_o_r_mapping/tree/master/pascal_o_r_mapping/3_Data Particularly, Formate_Liste from

Re: [fpc-pascal] Dependency of OpenSSL 1.0.2 still in FPC 3.2.0 on some platforms?

2021-05-12 Thread Jean SUZINEAU via fpc-pascal
I do not guarantee anything, I didn't use this recently, but I have a function for sending mail with attachments using Synapse. It's the function MailTo_SMTP in this unit : https://github.com/jsuzineau/pascal_o_r_mapping/blob/master/pascal_o_r_mapping/3_Data/uMailTo.pas (my code is under LGPL,

Re: [fpc-pascal] Directory Tree

2021-05-03 Thread Jean SUZINEAU via fpc-pascal
Le 03/05/2021 à 13:55, James Richters via fpc-pascal a écrit : >Defining it in public in TText_to_PDF is a good idea. I tried putting it under the destructor in public… above the private variables, but it wouldn’t compile thereI thought it would have to be above all the functions and

Re: [fpc-pascal] Directory Tree

2021-05-03 Thread Jean SUZINEAU via fpc-pascal
Le 02/05/2021 à 23:42, James Richters via fpc-pascal a écrit : But I’m thinking I didn’t really define the variable the way it would normally be done with Lazarus. Just for notice: classes and objects are not particular to Lazarus, it's plain Object Pascal, understood by Freepascal and Delphi

Re: [fpc-pascal] Directory Tree

2021-05-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/05/2021 à 15:27, James Richters via fpc-pascal a écrit : Any ideas how to save and restore the column widths for VirtualStrinTrees in the ini file? Done with the events and methods of TIniPropStorage. ___ fpc-pascal maillist -

Re: [fpc-pascal] Directory Tree

2021-05-01 Thread Jean SUZINEAU via fpc-pascal
Sorry, I didn' had time this week to have a look to your last additions. Le 01/05/2021 à 15:27, James Richters via fpc-pascal a écrit : Any ideas how to save and restore the column widths for VirtualStrinTrees in the ini file? I imagine it can be done through the events of the IniProperty

Re: [fpc-pascal] Directory Tree

2021-04-25 Thread Jean SUZINEAU via fpc-pascal
Le 25/04/2021 à 21:30, James Richters via fpc-pascal a écrit : >I added LoadFromFile in this event. That was the first thing I tried, but the problem is, this happens before anything is put on the screen.. so when I run the program with an Ini file with 4000 entries in it, there is

Re: [fpc-pascal] Directory Tree

2021-04-25 Thread Jean SUZINEAU via fpc-pascal
Le 25/04/2021 à 15:24, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree I fixed the time totals to show days correctly with this: I didn't use your pull request because I don't know yet how to handle it. I have delete some files which differed only by case. After

Re: [fpc-pascal] Directory Tree

2021-04-25 Thread Jean SUZINEAU via fpc-pascal
Le 25/04/2021 à 02:54, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree I’ve been trying make “Load from file”happen automatically when the program starts.. I would like it to happen after configuration.ini restores the file name and also after the form is on the screen

Re: [fpc-pascal] Directory Tree

2021-04-24 Thread Jean SUZINEAU via fpc-pascal
Le 23/04/2021 à 19:56, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree Get Checked or Selected works great, but if I push it twice, the second time I get: Unable to open file C:\Users\James\AppData\Local\Temp\FiC152.odt But I did make sure to close word and the PDF

Re: [fpc-pascal] Directory Tree

2021-04-23 Thread Jean SUZINEAU via fpc-pascal
Le 23/04/2021 à 11:08, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree Now if I type new text in the ODT document, it’s Consolas, but the actual text in the document is still Liberation Serif… and it doesn’t align, if I select all the text and change it to Consolas

Re: [fpc-pascal] Directory Tree

2021-04-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/04/2021 à 22:17, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree My system could not find DejaVuSans, You can find it in C:\lazarus\fpc\3.2.0\source\packages\fcl-report\demos\fonts. May be you don't need to install the font, just add on the line below where

Re: [fpc-pascal] Directory Tree

2021-04-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/04/2021 à 23:17, James Richters via fpc-pascal a écrit : For some reason the ODT file wants to know if I want to translate it from French, and while the font is “Courier New” for anything I would type into the document, the font of the text itself is “Liberation Serif” If I change the

Re: [fpc-pascal] Directory Tree

2021-04-21 Thread Jean SUZINEAU via fpc-pascal
Another way of seeing is to generate and odt file with the generated text. You get a slightly better rendering because I could define Courier New as default font in the new template: FileVirtualTree_txt_to_odt.odt From the OpenOffice "File" menu, you can generate a pdf file. There is a way

Re: [fpc-pascal] Directory Tree

2021-04-21 Thread Jean SUZINEAU via fpc-pascal
Le 18/04/2021 à 17:22, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree I figured out how to make a pdf file, but I don’t know how to implement it… if we can just have a button to print result.txt… then I could just change the printer to Microsoft Print to PDF which is

Re: [fpc-pascal] Directory Tree

2021-04-18 Thread Jean SUZINEAU via fpc-pascal
Le 18/04/2021 à 16:10, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree I getuFileVirtualTree.pas(533,9) Error: identifier idents no member "DefaultEncoding" It seems, using svn blame, that DefaultEncoding has been added in FreePascal source trunk on the svn server on

Re: [fpc-pascal] Directory Tree

2021-04-17 Thread Jean SUZINEAU via fpc-pascal
In Unicode/UTF8 "char" can be represented by several bytes so my code won't work. It seems you use page code 850 (here in France we are in 1252 which doesn't have the box chars). In unit uFileVirtualTree line 469, I have added   type String850= type String(850); declared the local variable

Re: [fpc-pascal] Directory Tree

2021-04-16 Thread Jean SUZINEAU via fpc-pascal
Le 15/04/2021 à 20:16, James Richters via fpc-pascal a écrit : It doesn't have to be a PDF, it could be an image file, or even a text file...maybe I can just make a text file of the output and use box characters to draw the tree. It seems like I should be able to get the branches of the

Re: [fpc-pascal] Directory Tree

2021-04-15 Thread Jean SUZINEAU via fpc-pascal
Le 15/04/2021 à 15:31, James Richters via fpc-pascal a écrit : How did you make the TVirtualStringTree open the first level? I've been looking to see how you did it but I don't see how that was done. unit uFileVirtualTree, line 360,  method ThVirtualStringTree.vst_expand_first_level; I

Re: [fpc-pascal] Directory Tree

2021-04-14 Thread Jean SUZINEAU via fpc-pascal
Le 14/04/2021 à 13:06, James Richters via fpc-pascal a écrit : I still can’t get off the Master branch on my windows machine. I deleted everything, re-forked it, re-cloned it, I finally found on my linux machine a 'test_gICAPI\jsLignes.Exclus.txt' file right in tools directory, and

Re: [fpc-pascal] Directory Tree

2021-04-13 Thread Jean SUZINEAU via fpc-pascal
Le 13/04/2021 à 13:50, James Richters via fpc-pascal a écrit : I tried to make a fork of your repository but I could not change off the master branch,, I always get an error: Checkout Failed Cannot checkout to invalid path 'tools/text_glCAPI\jsLignes.Exclus.txt' I suspect the / in the path

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
I have updated the VirtualTreeView example with sub-totals of time. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
TStringList works pretty much like an inifile section. The index corresponds to the line number in you text block. The Names property corresponds to the part of the line before the '=' char. The ValueFromIndex property corresponds to the part of the line after the '=' char. So if you line i

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
Indeed, I think it's difficult (if possible) to change the behaviour of the multiselection this way. The TTreeview.MultiSelectStyle property allows you to change from CtrL+Click to Shift+Click. https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tmultiselectstyle.html To make the multi

Re: [fpc-pascal] Directory Tree

2021-04-09 Thread Jean SUZINEAU via fpc-pascal
(I re-send my mail with different sender, it seem the first one has been blocked by orange) I made a short example based on TTreeView with your data at : https://github.com/jsuzineau/pascal_o_r_mapping/tree/TjsDataContexte/tools/FileTree You just need to download all the files , open project

Re: [fpc-pascal] Directory Tree

2021-04-08 Thread Jean SUZINEAU via fpc-pascal
If you just select files, as Bart stated in another message, I think TShellTreeView will be more adequate and easier than TTreeView (actually TShellTreeView is a file tree specific descendent TTreeView). In TTreeView (and TShellTreeView) you can enable multiselection by adding

Re: [fpc-pascal] Directory Tree

2021-04-06 Thread Jean SUZINEAU via fpc-pascal
As far as I understand, you are searching for a general tree component like TTreeView in Lazarus, but for FreeVision, running in text mode in console ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Formatting Question

2021-04-04 Thread Jean SUZINEAU via fpc-pascal
Le 04/04/2021 à 02:41, James Richters a écrit : That looks almost perfect.. can I suppress the trailing zeros with the format command without losing the alignment? As far as I know, no ... Not  with just the RTL. Anyway I have personal code for this, you can extract and customize it to

Re: [fpc-pascal] Formatting Question

2021-04-03 Thread Jean SUZINEAU via fpc-pascal
Normally something like this should do the trick (here 3 decimals and 7 characters for total width): program Format_Example; uses     sysutils; procedure F( _d: double); var    S: String; begin S:= Format('%7.3f',[_d]); WriteLn( S); end; begin F(0.5); F(2.53); F(12.5);

Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-31 Thread Jean SUZINEAU via fpc-pascal
Le 01/01/2021 à 00:48, James Richters via fpc-pascal a écrit : I’m not too familiar with PChars, but is there a way to set it to zero length? I set it to #0 and it works ok with the #0 in there with Notepadd++ but I think it’s technically not correct. For me, it's correct. C strings are

Re: [fpc-pascal] Reading Serial Hex Data

2020-12-28 Thread Jean SUZINEAU via fpc-pascal
Le 28/12/2020 à 13:16, Bo Berglund via fpc-pascal a écrit : Synchronize(CallEvent); //Supply received data in FBuffer to caller You are using TThread.Synchronize. In a console app, it's likely that somewhere else in your main thread you'll need to call regularly

Re: [fpc-pascal] Reading Serial Hex Data

2020-12-27 Thread Jean SUZINEAU via fpc-pascal
May be using TBlockSerial from unit synaser from Ararat Synapse ? ( doc: http://synapse.ararat.cz/doc/help/synaser.TBlockSerial.html , download: http://synapse.ararat.cz/doku.php/download ). Given a variable (SynSer: TBlockSerial;), you can test if data is available with SynSer.CanReadEx(0)

Re: [fpc-pascal] TurboVision is reborn as FOSS (again)

2020-12-25 Thread Jean SUZINEAU via fpc-pascal
Amazing ! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Jean SUZINEAU via fpc-pascal
Le 20/12/2020 à 16:02, James Richters via fpc-pascal a écrit : If I need a bunch of case statements, it's atcually worse than if I just have separate procedures. No, in fact the case statement is written only once, in the implementation of TAxisRecord, and in procedure

Re: [fpc-pascal] Selecting Records with a variable

2020-12-19 Thread Jean SUZINEAU via fpc-pascal
I know you don't like objects, but maybe something like : unit uAxisRecord; {$mode objfpc}{$H+} interface uses  Classes, SysUtils; type  { TAxisRecord }  TAxisRecord  =   object     X,Y,Z,A,B,C: Double;     function Value_from_Letter(

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-09 Thread Jean SUZINEAU via fpc-pascal
Le 09/10/2020 à 10:15, Santiago A. via fpc-pascal a écrit : Just nitpicking. Shouldn't "try" be after the "reset" and after the "rewrite"? Why don't you allow to write an empty string? Yes, you're right, the Reset/Rewrite should be after the try. I admit this code is not general, just

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-05 Thread Jean SUZINEAU via fpc-pascal
In my own code I use BlockRead/BlockWrite, but I'm wondering if I've not seen this somewhere in RTL. https://github.com/jsuzineau/pascal_o_r_mapping/blob/TjsDataContexte/pascal_o_r_mapping/02_Units/uuStrings.pas function String_from_File( _FileName: String): String;

Re: [fpc-pascal] basic question on begin, end;

2020-09-24 Thread Jean SUZINEAU via fpc-pascal
Personnally I go even further ;-) if something then begin some multi-line code here end else begin some multi-line code here end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Jean SUZINEAU via fpc-pascal
Another way is to declare TMyRec as class instead of record. In this case, you don't need the  dereference operator ^ . No need of new and dispose, just Create and Free, as for TMyRecList. I don't know if there is a better performance when you use a record, but as far as I know,

Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?

2020-09-01 Thread Jean SUZINEAU via fpc-pascal
Ooops, wrong url, I just learn know that property could belong to a global block... ;-) For classes: https://www.freepascal.org/docs-html/ref/refsu33.html#x86-1080006.7.1 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?

2020-09-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/09/2020 à 10:49, Bo Berglund via fpc-pascal a écrit : Is there no way to declare a property to have a default non-zero value? I'm not sure but I think the syntax is for this something like property ReadPacketSize: integer read FPacketSize write FPacketSize default 10; Reference: