From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
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.
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function AddNewWebBrowser(AComponent: TCLComponent; xName: string): TclWebBrowser;
</div>


  xWeb:= MyForm.AddNewWebBrowser(MyForm,'xWeb');
<span style="color:blue"><b>AComponent</b></span> : The variable name of the defined component is written. Here you have to write the name of the component you want in it.<br>


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.
<span style="color:blue"><b>xName</b></span> : The name of the defined component should be written.<br>


xWeb.Navigate('www.google.com');
To integrate a web browser using Clomosy, you can use the TclWebBrowser component.<br>


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.
To use it, you should create a form and create a Web Browser inside it.<br>


  xWeb.goForward;
<pre>
  WebBrowser1 = Form1.AddNewWebBrowser(Form1,'WebBrowser1');
</pre>


It is used to go back from one page. Example: You searched on Google and want to return to the home page.
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.<br>


  xWeb.goBack;
<pre>
  WebBrowser1.Navigate('www.google.com');
</pre>


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.
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.<br>


  xWeb.CanGoBack
<pre>
  WebBrowser1.goForward;
</pre>


It is used to go back from one page. Example: You searched on Google and want to return to the home page.<br>


'''Example:'''
<pre>
WebBrowser1.goBack;
</pre>


:'''TRObject Syntax'''
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.<br>


  Var
<pre>
  MyForm:TclForm;
  WebBrowser1.CanGoBack;
  xWeb:TclWebBrowser;
</pre>
  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;
  }


:'''Base Syntax'''
<b>Example</b><br>
<pre>
  Var
  Var
   MyForm:TclForm;
   MyForm:TclForm;
   xWeb:TclWebBrowser;
   xWeb:TclWebBrowser;
   xBtn,xBtn2 : TCLButton;
   xBtn,xBtn2 : TCLButton;
   xLyt: TclLayout;
   xLyt : TclLayout;
   
   
   procedure goForwardClick;
   void goForwardClick;
   begin
   {
     xWeb.goForward;   
     xWeb.goForward;   
   end;
   }
   
   
   procedure goBackClick;
   void goBackClick;
   begin
   {
     if xWeb.CanGoBack then
     if (xWeb.CanGoBack)
       ShowMessage('You can return to the page.')
       ShowMessage('You can return to the page.')
     else
     else
       ShowMessage('There is no page to go back to.');
       ShowMessage('There is no page to go back to.');
     xWeb.goBack;   
     xWeb.goBack;   
   end;
   }
   
   
  Begin
  {
   MyForm := TclForm.Create(Self);
   MyForm = TclForm.Create(Self);
   
   
   xLyt := MyForm.AddNewLayout(MyForm,'xLyt');
   xLyt = MyForm.AddNewLayout(MyForm,'xLyt');
   xLyt.Align := alTop;
   xLyt.Align = alTop;
   xLyt.Height := 45;
   xLyt.Height = 45;
   
   
   xBtn2 := MyForm.AddNewButton(xLyt,'xBtn2','goBack');
   xBtn2 = MyForm.AddNewButton(xLyt,'xBtn2','goBack');
   xBtn2.Align := alLeft;
   xBtn2.Align = alLeft;
   xBtn2.Width := 70;
   xBtn2.Width = 70;
   MyForm.AddNewEvent(xBtn2,tbeOnClick,'goBackClick');
   MyForm.AddNewEvent(xBtn2,tbeOnClick,'goBackClick');
   
   
   xBtn := MyForm.AddNewButton(xLyt,'xBtn','goForward');
   xBtn = MyForm.AddNewButton(xLyt,'xBtn','goForward');
   xBtn.Align := alLeft;
   xBtn.Align = alLeft;
   xBtn.Width := 70;
   xBtn.Width = 70;
   MyForm.AddNewEvent(xBtn,tbeOnClick,'goForwardClick');
   MyForm.AddNewEvent(xBtn,tbeOnClick,'goForwardClick');
   
   
   xWeb:= MyForm.AddNewWebBrowser(MyForm,'xWeb');   
   xWeb= MyForm.AddNewWebBrowser(MyForm,'xWeb');   
   xWeb.Align := alClient;
   xWeb.Align = alClient;
   xWeb.Navigate('www.google.com');
   xWeb.Navigate('www.google.com');
   
   
   MyForm.Run;
   MyForm.Run;
  End;
  }
</pre>
 
<h2> See Also </h2>
* [[Components]]
* [[Object Properties]]
* [[AddNewEvent]]

Revision as of 13:05, 7 November 2024

AComponent : The variable name of the defined component is written. Here you have to write the name of the component you want in it.

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');

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;
 }

See Also