Forum > Beginners
<solved> command line
Sprek Skik:
I am just beginning but i want to make an application with a command line option string (path name) that can be used by the program. How has the FormCreate be made?
RayoGlauco:
I'm not sure if this is what you are asking for. You can pass some parameters to your program, and check them in any part of your program: https://wiki.freepascal.org/Command_line_parameters_and_environment_variables
Sprek Skik:
well that's what i am looking for. But a test doesn't work.
unit unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs;//, StdDlg;
type
{ TForm1 }
TForm1 = class(TForm)
procedure Create(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Create(Sender: TObject);
var
i: integer;
begin
for i := 0 to paramCount() do
begin
showmessage(paramStr(i));
end;
end;
end.
cdbc:
Hi
This works for me in a button click-handler:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure procedure TForm1.Button1Click(Sender: TObject);var i: integer;begin for i := 0 to paramCount() do begin showmessage(paramStr(i)); end;end;...dunno 'bout 'FormCreate' though.
Regards Benny
TRon:
--- Quote from: cdbc on May 10, 2024, 09:21:02 pm ---...dunno 'bout 'FormCreate' though.
--- End quote ---
Works like a charm /everywhere/ (project file, unit initialization, unit finalization, form creation, form destruction, onidle, etc etc...)
My guess would be that the problem originates from supplying the parameter(s). Either that or the event(s) are not 'linked' because the object inspector was not used to create them.
Navigation
[0] Message Index
[#] Next page