Dear All
I have written a playlist programme for my mp3 player in Lazarus 2.0.8. It writes to an M3U file on the player and the programme is on the player as well. When the programme starts it reads the M3U file and places the content into a memo:
Memo1.Lines.LoadFromFile('PlayListStephen.m3u');
I have been using a TfileNameEdit window (and the OnChange event), to navigate to an MP3 file and select it. Then append it to the memo content:
TheFileName := FileNameEdit1.Text; // a variable := the path/file name
menuString := Memo1.Lines.Text; // a variable := the memo text
menuString := Concat(menuString, TheFileName); // concat the two variables
// Now write new content of menuString back into the Play List Window (Memo.Lines.Text)
Memo1.Lines.Text := menuString;
This works fine for one mp3 file selection. But I want to expand the programme to select multiple files. To this end I have set “OfAllowMultuSelect” of TfileNameEdit, to true. I can now select multiple files from within the Open window. When two or more files are selected their names appear in the input window (.Text property). However, the File Name input of the Open dialogue box shows the two files I selected, each contained in double quotes with a space between them. Like this: [ "SimpleForms.res" "SimpleForms.exe" ]. After pressing the Open button, I have coded to place the content of the Text property input to a variable:
TheFileName := FileNameEdit1.Text;
and then use it as a caption for a label, just to make sure I have both file names:
Label10.Caption := TheFileName;
The output/Caption is:
C:\Users\stephanos\MyFiles\Delphi(Lazarus)\PlayListV11\SimpleForms.exe
But I do not have both file names. Only the file name of the first selected file, and its full path. The full path is needed as are subsequent file names.
What is the best way to achieve this objective?
The answer appears to be use the onAcceptFileName event and SynEdit (SynMemo being deprecated). I added to “uses”:
SynEdit, SynEditKeyCmds;
but got this error message at compile:
“Compile Project, Target: SimpleForms.exe: Exit code 1, Errors: 1
simpleformsunit.pas(8,3) Fatal: Cannot find SynEdit used by SimpleFormsUnit.
Check if package SynEdit is in the dependencies of the Project Inspector.”
I found the Project Inspector but cannot progress as it is all new to me. I looked around but cannot find any clear instructions. I am using Windows 10 and Lazarus 2.0.8.
Any help appreciated and I also recognise this is a big ask