DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WebBrowser & PageControl tabs

 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
Coruscant
Member


Joined: 09 Oct 2006
Posts: 2

PostPosted: 09/10/06 16:27    Post subject: WebBrowser & PageControl tabs Reply with quote

Hi everyone =) I've got a little problem here. I've created my own browser based on TWebBrowser component. My browser uses tabs instead of new windows, but I have a little problem now. Everything works fine except when document is fully loaded I'd like to change Tab caption to loaded website's title. I've tried may ways but nothing works well. For example if I change the tab while site is loading, when it's done, caption is changing in tab where I'm currently in. I don't know how to get webbrowser's parent tab. I've tried parent, owner, getparentname and lots of other ways but I still can't get result I'd be satisfied. Of course all tabs are created at run-time.

That was one problem, and here is another one: Location URL. I've put it into TPageControl onChanging procedure. It also works half-fine. My address field changes after I change the tab, but it changes to previous tab URL. To make it simply:

Here are tabs:

|Yahoo|Google|Lycos|NY Times|

I'm in Yahoo tab, but when I change it to e.g. Lycos then address field is changing to http://www.yahoo.com/ and then I click on Google and then I receive http://www.lycos.com address. I don't know how to fix it.

Here's the code:

Code:


procedure TMainform.WebBrowserTabsChanging(Sender: TObject;
  var AllowChange: Boolean);
begin
WebAddress.Text := (WebBrowserTabs.ActivePage.Controls[1] as TWebBrowser).LocationURL;
end;

Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 10/10/06 10:24    Post subject: Reply with quote

  1. Use TWebBrowser.OnTitleChange event
  2. TPageControl.OnChanging occurs before changing the tab, use TPageControl.OnChange event

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Coruscant
Member


Joined: 09 Oct 2006
Posts: 2

PostPosted: 10/10/06 15:24    Post subject: Reply with quote

Thanks m8, but how to find out what is the tab that contains WebBrowser?

P.S. That onChange works well so only 1 problem left Smile
Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 11/10/06 19:25    Post subject: Reply with quote

When you create a new tab, you can assign its index to Tag property of the related WebBrowser.
_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group