Lazarus Feature suggestion lazarus / 13-General ---------------------------------------------------------------------- 440bx · 2020-02-18 09:29 Hello, I am using an older version of Lazarus (see signature) so maybe this feature has already been implemented, in that case, never mind The menu Run->Run Parameters shows a dialog box, one of the fields there is "Command line parameters (without application name)", since quite often the parameter is a filename, it would be very nice if it were possible to drag and drop a file from Windows Explorer (or whatever equivalent is in another O/S) and have the file name appear in the box.  It would be particularly nice if the drop handler inspected the filename for spaces and added the necessary quotes at the beginning and end of it. Another possibility would be to add a "..." button, like the ones for "Host application" and "Working directory" to the "Command line parameter etc" to select a filename. Either one can occasionally be quite a time saver. ---------------------------------------------------------------------- JernejL · 2020-02-18 09:36 I like this idea, and to extend it - a similar - quick "pick file" entry could be added to run dropdown menu. ---------------------------------------------------------------------- balazsszekely · 2020-02-18 12:04 @440bx 1. Open unit $(LazarusDir)\IDE\RunParamsOpts.pas 2. Set AllowDropFiles property to True(form property) 3. Create an OnDropFiles event: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TRunParamsOptsDlg.FormDropFiles(Sender: TObject;  const FileNames: array of string);var  I: Integer;  P: TPoint;begin  P := CmdLineParametersComboBox.ScreenToClient(Mouse.CursorPos);  if PtInRect(CmdLineParametersComboBox.ClientRect, P) then  begin    for I := High(FileNames) downto Low(FileNames) do    begin      if not IsCmdLineParamAlreadyExists(FileNames[I]) then      begin        CmdLineParametersComboBox.Items.Insert(0, FileNames[I]);        CmdLineParametersComboBox.ItemIndex := 0;      end;    end;  end;end; 4. Add function IsCmdLineParamAlreadyExists to the private section of the form Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TRunParamsOptsDlg.IsCmdLineParamAlreadyExists(const ACmdLineParam: String): boolean;var  I: Integer;begin  Result := False;  for I := 0 to CmdLineParametersComboBox.Items.Count - 1 do  begin    if CmdLineParametersComboBox.Items[I] = ACmdLineParam then    begin      Result := True;      Exit;    end;  end;end; 5. Add types to the uses clauses 6. Rebuild the IDE ---------------------------------------------------------------------- 440bx · 2020-02-18 14:11 @GetMem Thank you GetMem!... you definitely exceeded my expectations...    I didn't even dream of getting it shortly after suggesting it. I'll be following those steps _very_ soon... right now, I'm in the middle of some convoluted testing and I don't want to lose track of what I've done so far.  I'll post an update once done.  Thank you again. ---------------------------------------------------------------------- balazsszekely · 2020-02-18 19:17 @440bx You're welcome.