Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TabSheets & Frames & TWebBrowser

Posted on 2005-05-01
14
Medium Priority
?
412 Views
Last Modified: 2010-04-05

Hello All;
{
Demo Project Code can be downloaded from here
www.carrz-fox-fire.com/1/Frame+TabSheet.zip
}

   Having a little problem here, and wanted to see if someone could assist
me please.

This is what we are trying to do, But please see the Demo code provided as
well.


procedure TLinkFrame.Label1Click(Sender: TObject);
begin // The line below receives the "Undeclared identifier: 'BrowserFrame'
// When trying to call the BrowserFrame itself?

 //BrowserFrame.WebBrowser1.Navigate('http://www.borland.com/delphi/');

 MainPage.tsBrowser.Show; // Here we can show the WebBrowser1 on the TabSheet.

 // But how can we write it so that we can Navigate the Browser
 // that is located on the BrowserFrame? since it will not work as stated above
 // Would prefer to keep the WebBrowser in the Frame, this helps in the High Memory Usuage.
 // If the WebBrowser is assigned directly onto the tsBrowser page.
 // Then the other [LinksFrame] will never be freed? during the
 // OnHide   OnShow   Events.
end;

Demo Project Code can be downloaded from here
www.carrz-fox-fire.com/1/Frame+TabSheet.zip

Look in the Code for:   FrameLinks.pas | under the Label.OnClick event
It shows the code that is posted above.

Thanks All;
Carrzkiss
0
Comment
Question by:Wayne Barron
  • 8
  • 6
14 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 13910654
Here's a working solution, it may not be what you want but it works.

FrameLinks change:

procedure TLinkFrame.Label1Click(Sender: TObject);
var
  Frame: TBrowserFrame;
begin
  Frame := TBrowserFrame(MainPage.tsBrowser.Controls[0]);
  Frame.WebBrowser1.Navigate('http://www.borland.com');
  Frame.Show;
end;

FrameProject changes:

procedure TMainPage.FormCreate(Sender: TObject);
begin
  CreateFrame(tsLinks);
  CreateFrame(tsBrowser); // This is the key; need to create this frame
end;

procedure TMainPage.CreateFrame(ATabsheet: TTabSheet);
var
  frame: TFrame;
begin
  if GetFrame(ATabsheet) = nil then
  begin
    case ATabsheet.PageIndex of
    0:
      begin
        frame := TLinkFrame.Create(ATabsheet);
      end; {case: 0}
    1:
      begin
        frame := TBrowserFrame.Create(ATabsheet);
      end; {case: 1}
    end; {case}
    frame.Parent := ATabsheet;
    frame.Align := alClient;
  end; {if GetFrame..}
end;

procedure TMainPage.TabsheetShow(Sender: TObject);
var
  Sheet: TTabSheet;
  frame: TFrame;
  intf: IFrame;
begin
  Sheet := TTabsheet(Sender);
  frame := GetFrame(Sheet);
  if Supports(frame, IFrame, intf) then
  begin
    intf.OnShow;
  end; {if Supports...}
end;
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13910910
Thanks Eddie;

  It worked great in the Demo Project.
Just have to implement it into the main project now.

  Take Care
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13911087
Hello Eddie;

  In case you are interested.
I just found this information on Free the Memory of the TWebBrowser.
And other components.

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20445267.html

Works GREAT!!!!!!!
Read my post at the end of the page.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Author Comment

by:Wayne Barron
ID: 13911758
Hello Eddie;

  I have seemed to have run into a problem.
Could you have a look at this please?

On the FormCreate. I have the tsLinks & tsBrowser.TabVisible := False;
So that when the project runs it will now display the Each indivisual Tab.
And the tsLink.Show; for showing the LinksFrame onShow.

Anyway, When the project is run, it does not show anything?

Add this code to the existing project code (Including your modified code)
Then run it, and you will see that the "tsLinks" or nothing else will show.
Just basically the PageControl is showing but none of the Sheets are visible.

OnShow;
  tslinks.Show;

  tsLinks.Tag := Integer(TLinkFrame);
  tsBrowser.Tag := Integer(TBrowserFrame);
  CreateFrame(tsLinks);
  CreateFrame(tsBrowser); // This is the key; need to create this frame
  tsLinks.TabVisible := False;  // Hide Tabs when Run
  tsBrowser.TabVisible := False;
End;

Thanks for any information
Wayne
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13913352
Well, DUH, if you have TabVisible set to False, nothing will show. Don't set tsLinks TabVisible to False.
You must also set tsBrowser's TabVisible to True in TLinkFrame.Label1Click.

0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13913416
In the project that I have already done.
All Tabs are set to    TabSheet?.TabVisible := False;
When the project starts.
TabSheet1.Show;

This shows the first tab, From the first tab you are able to navigate through-out
The whole program.

But in the Revised code from you.
I loose this ability to do this.
Even the TabSheet1.Show;
Does not work no more, as it is the first thing called on the OnCreate.

So. no offense.
But Duh. It works great in the old way.

Thanks Eddie, for the help on this.
I will see what I can do.
Luckly I made a backup copy of the Project code(s).

Take Care now
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13917672
I just don't understand, do you want tabs showing or not?
If you want it without the tabs showing, I'd switch to TNotebook as it is easier
to use but I'm not sure if you can do what you want with it.
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13918701
I figured it out, while making up a demo to show you.
Had to put the "tsLinks.Show" below the "tsLinks.TabVisible := False;"


See when the project is runned
All the [Tab]'s are set to:  TabVisible := False;
(While in Design they are all TabVisible := True; this of course makes the design process easier).

When the Project is Runned
TabSheet1.Show;
Is called from the OnCreate.

It is like making a "Tips of the Day".
How you can make the "Tips of the Day" with a PageControl.
Have lets say: 12 TabSheets on the Form.
When you run your project, All the [Tab]'s are set to: TabVisible := False;
As you do not want the Tabs to show in the "Tip of the Day" Form.
The only TabSheet that is called (Without the Tab) will be

FormCreate
TabSheet1.Show;
End;
So that the 1st TabSheet is shown, and then you click on the Button for

Button1Click
TabSheet2.Show;
End;

And so on.

Will this is basically like what I am doing for the Catalog project.
It is setup like the "Tips of the Day"

Here is a Demo code, of a Tips of the Day for you.

http://www.carrz-fox-fire.com/1/TipsoftheDay.zip

Just a simple little project.
Just open it up, and then run it.

I have it all fixed now, and the code that you suplied now works like a charm.

Take Care
Wayne
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13918947
Actually it will only show the First Tabsheet  tsLinks.
But it will not show the other sheets.
So back to the drawing board.

Everything works in the code that I am using with the WebBrowser on the
TabSheet itself, and not in the Frame.
But in the Frame, with your code, it does not work.

So. Anyway, I am going to continue working on the original project code.
As it is all fully functional.
And with the code for "Memory Usuage" I have the project down to.
987kb to 1,296kb
So it is running pretty good right now.

Will let you know if I figure out the issue with the Frames.
And the TabSheet.TabVisible := False;
And see if I can get it to working.

Take Care
Wayne
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13919566
Let me take another look at it with the tsBrowser.tabvisible set to false.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13931032
Ok, so that is how you want it? You don't want to show a tab for the Browser frame?
That looks kind of funky to me.
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13931103
Yes basically just like it looks in the "Tip of the Day" demo that I provided for you.
No [Tab]'s are to be shown what so ever in the project.
It is like a Book. So no "Bookmarks ;-) " so to speak.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13936349
Then how do you get back to the LINKS?
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 13937692
Just like the "Tips of the day" demo.
Simply make your call like so.

tsLinks.Show;

This will open the links page.
Except in the project itself, there will be a MainMenu with the MenuItem
That states: [Back to Link] (or) a button.
Quite simple really.

tsLinks.Show; // For the LinksFrame TabSheet.
tsBrowser.Show; // For the BrowserFrame TabSheet.

Take Care
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question