Home > Back-end >  PageControl and PageControl1 more problems
PageControl and PageControl1 more problems

Time:09-27

PageControl and PageControl1 create dynamic page
But closed problems
As long as the release of the current page will go wrong for many times expert guidance

CodePudding user response:

If PageControl1. ActivePage. Caption & lt;> 'front page' then
PageControl1. ActivePage. Free;

Judgment to create the page title when the page title is not equal to the home page to create free
But click the page will have superior to solve no error

CodePudding user response:

If PageControl1. ActivePage. Caption & lt;> 'front page' then
PageControl1. ActivePage. Free;

Where is the code above wrote it? In addition, the TabSheet release, if there are any other code?

CodePudding user response:

Can add QQ, I really can't say all code or copy

CodePudding user response:

PageControl1 released Webbrowser dynamically created cannot really close

CodePudding user response:

reference 4 floor shcxd001 response:
PageControl1 released Webbrowser dynamically created cannot really close


You have extracted the relevant code, send email: [email protected], I took the time to help you see,

CodePudding user response:

reference 5 floor lynmison reply:
Quote: refer to 4th floor shcxd001 response:

PageControl1 released Webbrowser dynamically created does not close really


You put the relevant code is extracted and sent to your email: [email protected], I took the time to help you see,
good man!

CodePudding user response:

Have been to the great god all hair past the Webbrowser dynamic whether can't closed closed and voice

CodePudding user response:

A, define the type of a page
Type
TTabSheetEx=class (TTabSheet)
Private
EWB: TEmbeddedWB;//TEmbeddedWB
CanBack: Boolean;//Back key is available
CanForward: Boolean;//the Forward button is available
CanStop: Boolean;//Stop button is available
The end;

Second, dynamically create a page
Procedure TMainForm. AddSheetEx (URLStr, sName: String; K: integer);//k=1 to join OnDownloadComplete event
Var TabSheetEx: TTabSheetEx;
The begin
Try
IFlag:=iFlag + 1;
SetLength (TabSheetExList iFlag + 1);
TabSheetEx:=TTabSheetEx. Create (PageControl1);
TabSheetExList [iFlag] :=TabSheetEx;
PageControl1. ActivePage:=TabSheetEx;
With TabSheetEx do
The begin
PageControl:=PageControl1;
Tag:=iFlag;
Caption:=sName;
EWB:=TEmbeddedWB. Create (TabSheetEx);
TOleControl (TabSheetEx. EWB). Parent:=TabSheetEx;
With EWB do
The begin
Tag:=iFlag;
LoadSettings;
Align:=alClient;
Visible:=True;
OnStatusTextChange:=StatusTextChangeEvent;
OnNewWindow2:=NewWindow2Event;
OnNewWindow3:=NewWindow3Event;
OnDownloadComplete:=DownloadCompleteEvent;
OnCommandStateChange:=CommandStateChangeEvent;
If k=1 then
OnDocumentComplete:=EmbeddedWB1DocumentComplete;
The Go (URLStr);
The end;
The Show;
TabSheetEx. EWB. SetFocus;
The end;
Except,
The end;
The end;

Three, create page
Procedure TMainForm. LinksClick (Sender: TObject);
Var sName: string;
The begin
If (Sender as TToolButton). Hint="' then the Exit;
IEAddress1. Text:=(Sender as TToolButton). Hint;
SName:=(Sender as TToolButton). Caption;
AddSheetEx (IEAddress1. Text, sName, 0);
The end;

Four, delete (page release)
Procedure TMainForm. StopClick (Sender: TObject);
Var Tab: TTabSheetEx;
Web: TEmbeddedWB;
I: Integer;
The begin
If PageControl1.Com ponentCount<2 then the Exit;
Try
Tab:=(PageControl1. ActivePage as TTabSheetEx);
TabSheetExList [Tab. The Tag] :=nil;
Tab. Free;
PageControl1. ActivePage:=PageControl1. Pages [PageControl1.Com] ponentCount - 1;
Except,
The end;
The end;


The last note:
1, use the code above their own browser, can be dynamically created, can be specified to delete the page,
2, as a result of using the WebServer, this is the characteristic of Microsoft, even release web pages, but the web page memory does not release, so many times to open the page after the victory over memory is very big,
3, if you want to release the memory, can shut down the program (thread), open the program again (specified page),




CodePudding user response:

Lyhoo163 warrior can help remote I see I will give you can purchase more credits top-up

CodePudding user response:


The building Lord, you write the code is really mess
  • Related