delphi - Display a form in two different ways -


i display form in 2 different ways. first 1 child of tab sheet of page control this:

myform := tmyform.create(<tab sheet of page control>); myform.parent := <tab sheet of page control>; myform.align := alclient; myform.borderstyle := bsnone;  myform.visible := true; 

this tab visible.

the second time display normal form this:

myform := tmyform.create(nil); myform.showmodal; 

i because need display same form visual controls visible , in second time hidden.

my problem noticed application consume more memory each time open form using second method , if used action := cafree in close event access violation when try shutdown application while tab sheet opened how should fix without using 2 forms same controls ?.

i use delphi xe5

tform never intended or designed embedded in other controls. use tframe instead, designed purpose.

var   frame: tmyframe; begin   frame := tmyframe.create(thetabsheet);   frame.parent := thetabsheet;   frame.align := alclient;   frame.visible := true; end; 

var   form: tform;   frame: tmyframe; begin   form := tform.createnew(nil); // yes, blank tform   try     form.width := ...;     form.height := ...;     form.caption := ...;     frame := tmyframe.create(form);     frame.parent := form;     frame.align := alclient;     frame.visible := true;     form.showmodal;       form.free;   end; end; 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -