delphi - Close Metro Application -
i created metro app using vcl metropolis ui application on file-new menu.
i surprised close app with:
procedure tsplitform.closebuttonclick(sender: tobject); { closebuttonclick. } begin application.terminate; end; rather usual: procedure tsplitform.close1click(sender: tobject); { close1click. } begin close; end;
i see application.terminate posts postquitmessage(0);
is there difference between close , terminate... , necessary close metro app application.terminate?
as no 1 else has offered answer here...
a metropolitan ui application uses tsplitform = class(tform)
, tdetailform = class(tform)
, tform
forms.tform
. there's nothing different it, question whether in metropolitan ui changes things.
a @ 2 generated forms in vcl metropolitan ui split screen application shows nothing unusual in way of components used, there's nothing affects behavior except actual code generated. (they're usual tpanel
, tgridpanel
, tgesturemanager
, , other standard vcl components; there's nothing see being used isn't available other vcl application.)
a test shows close
in main form exits application usual. therefore, there's no functional difference. quick @ vcl source says there's no alternate code path metropolitan apps.
the real difference between close
, application.terminate
close
checks see if it's modal form or not , whether onclosequery
has been assigned , should called. checks see if it's main form; if is, calls application.terminate
. vcl.forms, xe4 update 1, approx. line #6812:
if application.mainform = self application.terminate
the metropolitan vcl app template seems avoid usual close processing , directly terminate application. there's no indication anywhere of why needed can find.
actually, after more reviewing code generated metro vcl template, looks call application.terminate
made precisely because skips normal form.close
processing , exits, more typical of real metro applications. (it's of interest closebutton
isn't button, instead timage
.)
the definitive answer why uses application.terminate
instead of usual close
may determined if involved in writing application template ide generates stops , tells us. :-)
Comments
Post a Comment