🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.delphi.misc
3 messages
3 total messages Started by Saige Losli Thu, 24 Oct 2002 23:51
Create form in IDE but minimize resources used?
#456
Author: Saige Losli
Date: Thu, 24 Oct 2002 23:51
11 lines
1596 bytes
Hello,

I am using Delphi 4. I have created a resource-intensive form with
lots of controls on many tabs. It is so big that some machines run
out of memory and crash when using it.

Is there a way to create forms using Borland's drag-and-drop IDE,
yet not "instantiate" any controls on a tab until that tab is
activated? Likewise, discard the controls when selecting a new tab.

Any short coding examples, please? Thanks.
Re: Create form in IDE but minimize resources used?
#457
Author: KLinZ
Date: Fri, 25 Oct 2002 17:04
19 lines
2114 bytes
Saige Losli wrote:
> Hello,
>
> I am using Delphi 4. I have created a resource-intensive form with
> lots of controls on many tabs. It is so big that some machines run
> out of memory and crash when using it.
>
> Is there a way to create forms using Borland's drag-and-drop IDE,
> yet not "instantiate" any controls on a tab until that tab is
> activated? Likewise, discard the controls when selecting a new tab.
>
> Any short coding examples, please? Thanks.


Use TWinControl.DestroyHandle for the tabs that are not visible. Delphi will
re-create the handles if needed.

--
www.zenobits.com
Re: Create form in IDE but minimize resources used?
#455
Author: GB Blanchard
Date: Fri, 25 Oct 2002 17:30
26 lines
2127 bytes
On 24 Oct 2002 16:51:11 -0700, Saige Losli wrote:

> Hello,
> Is there a way to create forms using Borland's drag-and-drop IDE,
> yet not "instantiate" any controls on a tab until that tab is
> activated? Likewise, discard the controls when selecting a new tab.

 If I understand your question correctly, I think this is what you 
are looking for:

procedure TOptionsForm.PageControl1Change(Sender: TObject);
//To save resources with a TPageControl you can use the following 
TPageControl OnChange event handler:
//Put this in at top after interface: type TMyWinControl = 
class(TWinControl);
var
  i: Integer;
begin
  with Sender as TPageControl do
    for i := 0 to PageCount - 1 do
      if Pages[i] <> ActivePage then
        TMyWinControl(Pages[i]).DestroyHandle;
end; //PageControl1Change

====
Brad Blanchard
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads