Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-08 Thread Martin Wynne via fpc-pascal
Hi Thomas, The error is not the file content after "end.". The error is not having the expected "end;" after "begin". This works ok: _ program test; begin end; end. abc 123 _ Martin. ___ fpc-pasca

Re: [fpc-pascal] case statement

2023-12-14 Thread Martin Wynne via fpc-pascal
I've been using ELSE in IF statements and in CASE statements for 25 years without realising there was a problem. What a dim-wit I have been. Martin. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailma

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

2023-06-17 Thread Martin Wynne via fpc-pascal
On 17/06/2023 19:07, Travis Siegel via fpc-pascal wrote: This is interesting, because it's the first time I've ever seen "break" as a valid command in pascal, and I've been using pascal since the mid/late 80s.  All kinds of dialects too, and I've never seen break as a keyword.  C, Python, Perl,

Re: [fpc-pascal] Pause Key

2023-04-13 Thread Martin Wynne via fpc-pascal
On 14/04/2023 01:31, James Richters via fpc-pascal wrote: Does anyone know what's up with the Pause key in Windows? Is there some way to tell if it was pushed? Hi James, // Tform.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState); begin if Key=VK_PAUSE

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

2022-09-12 Thread Martin Wynne via fpc-pascal
On 12/09/2022 15:37, James Richters via fpc-pascal wrote: So I could just do this? Index:= MyStringlist.IndexOfName(SearchName); If Index >=0 then MyValue := MyStringlist[Index].ValueFromIndex; Hi James, I would probably do try with MyStringList do MyValue:=ValueFromIndex[IndexOfN

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

2022-09-12 Thread Martin Wynne via fpc-pascal
On 12/09/2022 14:16, James Richters via fpc-pascal wrote: The problem with the for in loop is that I need the index. Hi James, You don't need a loop for that: index:=MyStringlist.IndexOfName; see: https://www.freepascal.org/docs-html/rtl/classes/tstrings.indexofname.html martin.

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

2022-09-10 Thread Martin Wynne via fpc-pascal
On 10/09/2022 17:01, James Richters via fpc-pascal wrote: For Loop := 0 to MyStringList.Count-1 do It would be nice to not have the -1 I don't understand what is wrong with Count-1, but you can get the highest index like this if you wish: high_index:=Length(Trim(MyStringList.Text))-Length(

Re: [fpc-pascal] How to find where my app consumes CPU?

2021-05-19 Thread Martin Wynne via fpc-pascal
On 18/05/2021 20:59, Bo Berglund via fpc-pascal wrote: I have a pretty sizable console app written with Delphi 15 years ago but ported to Linux using FreePascal (3.2.0) with Lazarus (2.0.12) as IDE. I have the same problem with high CPU usage for a 20-year-old Delphi App compiled in Lazarus(2.

Re: [fpc-pascal] Illegal counter variable?

2019-09-11 Thread Martin Wynne
If step is wanted, it's easy enough: For n:=a to b Do   Begin     if n Mod step <> 0 then Continue;     ... p.s. make that if (n-a) Mod step <> 0 then Continue; for cases where a is not a multiple of step. Martin. ___ fpc-pascal maillist -

Re: [fpc-pascal] Illegal counter variable?

2019-09-11 Thread Martin Wynne
I am not aware of any Pascal implementation that does have a STEP parameter for FOR loops If step is wanted, it's easy enough: For n:=a to b Do Begin if n Mod step <> 0 then Continue; ... Martin. ___ fpc-pascal maillist - fpc-pascal@lis

Re: [fpc-pascal] Illegal counter variable?

2019-09-09 Thread Martin Wynne
On 09/09/2019 15:11, James Richters wrote: If (I>86) And (I<95) then Continue; What does continue do exactly? Loop back to the beginning of the for loop right away? Hi James, Yes in effect -- it jumps forward to the test at the end of a loop. Very useful. See: https://www.freepascal.org/d

Re: [fpc-pascal] Illegal counter variable?

2019-09-09 Thread Martin Wynne
On 09/09/2019 13:38, James Richters wrote: Var I:Byte; Begin I:=57; For I := I to 100 do Begin If I=87 then I:=95; Write(I,' '); End; End. Why not: Var I:Byte; Begin I:=57; For I := I to 100 do Begin If (I>86) And (I<95) the

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Martin Wynne
I have only 2 eyes, so I'm going to find 3 screens a problem. Martin. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] precedence "is" and "and"

2018-12-08 Thread Martin Wynne
var b: boolean; o: TObject; begin // this compiles, but should fail: if o is TComponent and b then ; It will compile if $BOOLEVAL is on the default (-) because the result can be determined without considering precedence, see: https://www.freepascal.org/docs-html/prog/progsu4.ht

Re: [fpc-pascal] Uniform initialization?

2018-11-13 Thread Martin Wynne
Delphi mode is very useful. It means old code from earlier versions of Delphi (in my case Delphi5) can be open-sourced and made available via Lazarus to anyone interested, without their needing to get an expensive copy of the latest Delphi. Martin.

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-04 Thread Martin Wynne
The Lazarus version is mostly working in Lazarus, but instead of everything happening before the form is loaded, is there a way I could make the form first, then just start processing everything, so that my messages I send to memo1 show up as it's processing? I'm guessing I need to move my p

Re: [fpc-pascal] Anchors on a child form

2018-06-04 Thread Martin Wynne
Hi Mattias, Thanks for your reply. 'TWinControl.WMSize loop detected, the widgetset does not like the LCL bounds or sends unneeded wmsize messages'. Can you create a bug report with an example to reproduce the loop? Sorry, I don't know how to do that. However, it is very easy to replicate:

Re: [fpc-pascal] Anchors on a child form

2018-06-04 Thread Martin Wynne
This appears to be a topic for the Lazarus list, as it appears that you're using the Lazarus LCL: laza...@lists.lazarus-ide.org There you may obtain adequate assistance. Giuliano Thanks. Sorry for posting to the wrong list. Martin. ___ fpc-pascal

[fpc-pascal] Anchors on a child form

2018-06-03 Thread Martin Wynne
If I create a child form by setting Parent:=other_form; in FormCreate, it cannot be dragged to a new position by the user. If I then remove the top and left anchors by setting Anchors:=[]; in FormCreate (or in the Object Inspector) so that it can be dragged, I get this exception: 'TWinContro