Re: [fpc-pascal] Getting Shift key with PTCCRT

2022-09-12 Thread Tomas Hajny via fpc-pascal
On 2022-09-12 21:41, Nikolay Nikolov via fpc-pascal wrote: On 9/10/22 17:57, James Richters via fpc-pascal wrote: Thanks for the suggestion I think the syntax should be: type myKeyEvent = IPTCKeyEvent; Var myShiftStatus : boolean; myShiftStatus := myKeyEvent.Shift; but I get IPTCKeyEvent not

Re: [fpc-pascal] Getting Shift key with PTCCRT

2022-09-12 Thread Nikolay Nikolov via fpc-pascal
On 9/10/22 17:57, James Richters via fpc-pascal wrote: Thanks for the suggestion I think the syntax should be: type myKeyEvent = IPTCKeyEvent; Var myShiftStatus : boolean; myShiftStatus := myKeyEvent.Shift; but I get IPTCKeyEvent not found. I wonder if it's only designated as internal.. or

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 James Richters via fpc-pascal
So I could just do this? Index:= MyStringlist.IndexOfName(SearchName); If Index >=0 then MyValue := MyStringlist[Index].ValueFromIndex; That sure is nice to know, Thank you! I guess for my dynamic arrays of records, I still need to search with a loop... or is there a cool thing I don't kn

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-12 Thread James Richters via fpc-pascal
The problem with the for in loop is that I need the index. I'm sometimes searching through the stringlist looking for a match, and when I find a match, I want to read the value And then do a break, because there is no point is searching once I found what I am looking for: For I:= 0 to MyStringl

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

2022-09-12 Thread Peter B via fpc-pascal
On 12/09/2022 07:52, Jean SUZINEAU via fpc-pascal wrote: As Bart suggested, you can use too the for/in loop:  for s in sl do WriteLn( s); And that is IMHO by far the most elegant, and least error prone, representation. Cheers, Peter ___ fpc-pascal m