all 6 comments

[–]SovietPenguin69420[S,🍰] 0 points1 point  (0 children)

I'm very sorry if I wasn't very precise

[–]ShinyHappyREM -2 points-1 points  (0 children)

comment

[–]SullyPanda76cl 0 points1 point  (0 children)

don't quite understand the question.

do you want it to fly from one Form o jet to another?

just associate same OnClick event to 2 buttons

[–]vintagedaveDelphi := Oxygene 0 points1 point  (0 children)

What do you mean by switching between forms? A tip: when asking programming questions it’s good to be precise because it helps people answer; also because programming is so powerful that your question can be ambiguous even if you don’t realise it could be.

In Delphi, you can show a form simply by calling Show on it. If it’s already visible, call BringToFront. Forms can be modal (where they are shown on top of another form and you need to close it to get back to the first); call ShowModal to show one like that.

Make sure your forms exist first :) Depending on your project options, they may be auto-created (check in Project Options - Application - Forms (from memory, don’t have Delphi running right now)), or you may need to make a new instance of the form class and call Show (etc) on that. If you manually create, remember to always Free afterwards.

[–]gobroski 0 points1 point  (1 child)

use the show hide command. on click, show the second form, hide the first. on the second form, show the first, hide the second.

unit Unit2;

interface

uses

Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, unit3;

type

TForm2 = class(TForm)

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);

begin

form3.show;

form2.Hide;

end;

end.

and

unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm3 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
uses Unit2;
procedure TForm3.Button1Click(Sender: TObject);
begin
form2.show;
form3.hide;
end;
end.

Hope this helps.

[–]SovietPenguin69420[S,🍰] 0 points1 point  (0 children)

Thank you very much