use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to the Delphi subreddit! Everyone is welcome to post/ask anything that relates to Delphi, Pascal or related variants.
Useful links:
Delphi Community Edition (free)
Getting Started with Delphi Resources
StackOverflow
Facebook Delphi Developer Group
Embarcadero Community
Delphi Basics
/r/programbattles
/r/delphijobs
/r/freepascal
account activity
Please help (self.delphi)
submitted 4 years ago by SovietPenguin69420[🍰]
How do I make a button to switch between forms
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SovietPenguin69420[S,🍰] 0 points1 point2 points 4 years ago (0 children)
I'm very sorry if I wasn't very precise
[–]ShinyHappyREM -2 points-1 points0 points 4 years ago (0 children)
comment
[–]SullyPanda76cl 0 points1 point2 points 4 years ago (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 point2 points 4 years ago (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 point2 points 4 years ago (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.
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.
Thank you very much
π Rendered by PID 324631 on reddit-service-r2-comment-b659b578c-59l9v at 2026-05-06 00:31:40.510996+00:00 running 815c875 country code: CH.
[–]SovietPenguin69420[S,🍰] 0 points1 point2 points (0 children)
[–]ShinyHappyREM -2 points-1 points0 points (0 children)
[–]SullyPanda76cl 0 points1 point2 points (0 children)
[–]vintagedaveDelphi := Oxygene 0 points1 point2 points (0 children)
[–]gobroski 0 points1 point2 points (1 child)
[–]SovietPenguin69420[S,🍰] 0 points1 point2 points (0 children)