Jump to content

Link Click


Peter Smit

Recommended Posts

Unigui is grate.

 

I am trying to create a simple application with records of webpage addresses, I can do this

I want to have a text link or button click from the UniDBedit to open a new page in the web browser. 
What am i doing wrong:
This is what i did:
OnMouseEnter ----> GetHTMLClickMouseEnter:  Code

 

Var GetHTML:String;
begin
  GetHTML:= '<a href="' + HTMLUniDBEdit.Text + '/" target="new">Visit</a>';  <-----Copy the Address to GetHTMLClick
  GetHTMLClick.Hint:= HTMLUniDBEdit.Text;    <----mouse over displays the web-address 
  GetHTMLClick.Caption:= GetHTML;
end;

 

It is only working with some sites, is there a simple way that works

 

The Unigui static example tested OK 

Link to comment
Share on other sites

  • 3 months later...

Hi everyone, I found a way and got the Link click to work

First you need to add this to the uses uniGUIVars, uniGUIApplication, StrUtils;

Remember GetHTMLClick:= UniLabel

also remember to set the TextConversion to txtHTML

 

OnMouseEnter ----> GetHTMLClickMouseEnter:  Code

Var
  GetHTML:String;
  URL: String;

begin

  URL:= '';    // clear 
  GetHTML:= '';  // clear 
  if LeftStr(HTMLUniDBEdit.Text, 7) = 'http://' then    //check if the link has http and set the link 
   begin
    URL:='<a href="' + HTMLUniDBEdit.Text + '" target="_blank">Visit</a>';    //set the address to show in a new page
    GetHTMLClick.Hint:= HTMLUniDBEdit.Text;    //mouse over to show the link
    GetHTMLClick.Caption:= URL;
   end
   else
   begin
   GetHTMLClick.Hint:= 'http://' + HTMLUniDBEdit.Text;           // mouse over to show the link with the added Http://
   URL:= '<a href="' + GetHTMLClick.Hint + '" target="_blank">Visit</a>';        //set the address to show in a new page
   GetHTMLClick.Caption:= URL;
   end;

end; 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...