Your TreeView must have the same name that is stored in SchuellerRP.dat, that is "tv_eg1"
* Mac Mini M1
* macOS 14.6.1
* Lazarus 3.99
* FPC 3.3.1
The data in
SchuellerRP.dat loads okay, although I did have to hard code the full path to get it to load. The problem comes with the code in
procedure TForm1.btnSelectClick(Sender: TObject);
begin
if SchuellerTreeV.Selected.Selected <> True then // <== AVs here
begin
ShowMessage('Please select a symptom-remedy to add to list');
exit;
end;
end;
I haven't yet investigated that because I have been distracted by an apparent bug in
3.99 for macOS aarch64...
UPDATE: this code works when the app is run
without debugging because ParamStr(0) returns the app bundle path (
/Users/carlcaulkett/Code/fpc/SchuellersBook/SchuellersRepertory.app) in this case, and the ExtractFileDir is able to obtain the app folder.
However, if run
with debugging, ParamStr(0) returns the path of the internal Unix executable (
/Users/carlcaulkett/Code/fpc/SchuellersBook/SchuellersRepertory.app/Contents/MacOS/SchuellersRepertory) in this case.
procedure TForm1.FormCreate(Sender: TObject);
var
F: TFileStream;
DataPath: string;
begin
DataPath := ExtractFileDir(ParamStr(0)) + DirectorySeparator + 'SchuellerRP.dat';
F := TFileStream.Create(DataPath, fmOpenRead or fmShareDenyWrite);
try
F.ReadComponent(SchuellerTreeV);
finally
F.Free;
end;
end;