On Sun, 22 Jul 2018 07:52:40 +0200 (CEST), Michael Van Canneyt via Lazarus <lazarus@lists.lazarus-ide.org> 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 -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus