From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 19: | Line 19: | ||
<pre> | <pre> | ||
WebBrowser1.Navigate('www.google.com'); | WebBrowser1.Navigate('www.google.com'); | ||
</pre> | |||
The URL property is used to determine which URL the browser is navigating to. This property returns the URL of the currently loaded page in the browser as a string value. | |||
<pre> | |||
UrlStr = WebBrowser1.URL //UrlStr : String; | |||
</pre> | </pre> | ||
Revision as of 15:08, 12 December 2024
function AddNewWebBrowser(AComponent: TCLComponent; xName: string): TclWebBrowser;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined component should be written.
To integrate a web browser using Clomosy, you can use the TclWebBrowser component.
To use it, you should create a form and create a Web Browser inside it.
WebBrowser1 = Form1.AddNewWebBrowser(Form1,'WebBrowser1');
The 'Navigate' method is used to navigate the browser to the specified URL. This method is used when you want to load a specific web page.
WebBrowser1.Navigate('www.google.com');
The URL property is used to determine which URL the browser is navigating to. This property returns the URL of the currently loaded page in the browser as a string value.
UrlStr = WebBrowser1.URL //UrlStr : String;
Using the "goForward" function refers to going to a page in a web browser's history. That means returning to the previous page from an undone step in the browser.
WebBrowser1.goForward;
It is used to go back from one page. Example: You searched on Google and want to return to the home page.
WebBrowser1.goBack;
The CanGoBack feature specifies the browser's ability to go backwards. This property returns True if it is possible to go back one page; otherwise it returns False.
WebBrowser1.CanGoBack;
Example
Var
MyForm:TclForm;
xWeb:TclWebBrowser;
xBtn,xBtn2 : TCLButton;
xLyt : TclLayout;
void goForwardClick;
{
xWeb.goForward;
}
void goBackClick;
{
if (xWeb.CanGoBack)
ShowMessage('You can return to the page.')
else
ShowMessage('There is no page to go back to.');
xWeb.goBack;
}
{
MyForm = TclForm.Create(Self);
xLyt = MyForm.AddNewLayout(MyForm,'xLyt');
xLyt.Align = alTop;
xLyt.Height = 45;
xBtn2 = MyForm.AddNewButton(xLyt,'xBtn2','goBack');
xBtn2.Align = alLeft;
xBtn2.Width = 70;
MyForm.AddNewEvent(xBtn2,tbeOnClick,'goBackClick');
xBtn = MyForm.AddNewButton(xLyt,'xBtn','goForward');
xBtn.Align = alLeft;
xBtn.Width = 70;
MyForm.AddNewEvent(xBtn,tbeOnClick,'goForwardClick');
xWeb= MyForm.AddNewWebBrowser(MyForm,'xWeb');
xWeb.Align = alClient;
xWeb.Navigate('www.google.com');
MyForm.Run;
}