Just starting out? Need help? Post your questions and find answers here.
Jarlve
 
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

Web page link

by Jarlve Mon Jun 25, 2018 8:38 am

Hey all,

I want to use HyperLinkGadget (or a button) to link to a web page so that clicking on it would open the web page in a new tab.

Possible?

Thanks.
User avatar
Peter
 
Posts: 546
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Web page link

by Peter Mon Jun 25, 2018 9:38 am

Code: Select all
Enumeration
  #Window
  #HyperLinkGadget
EndEnumeration

Procedure RunProgram(Filename.s, Parameter.s)
  !  if (v_parameter != "") {
  !    var win = window.open(v_filename, v_parameter);
  !    win.focus();
  !  } else {
  !    window.open(v_filename);
  !  }
EndProcedure

Procedure HyperLinkGadgetEvent()
 
  RunProgram("http://www.spiderbasic.com", "_blank")
 
EndProcedure

OpenWindow(#Window, 0, 0, 270, 160, "HyperlinkGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

HyperLinkGadget(#HyperLinkGadget, 10, 10, 250,20,"Red HyperLink", RGB(255,0,0))

BindGadgetEvent(#HyperLinkGadget, @HyperLinkGadgetEvent())


Greetings ... Peter
Jarlve
 
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

Re: Web page link

by Jarlve Tue Jun 26, 2018 6:43 am

Wonderful. Thank you very much Peter.

The ! indicate inline JS?
User avatar
Peter
 
Posts: 546
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Web page link

by Peter Tue Jun 26, 2018 6:55 am

Jarlve wrote:Wonderful. Thank you very much Peter.
you're welcome.

Jarlve wrote:The ! indicate inline JS?
yes. It is also possible to encapsulate a JavaScript-Block with EnableJS / DisableJS,
but in this case the SpiderBasic-IDE incorrectly changes the if to If.

Greetings ... Peter
Jarlve
 
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

Re: Web page link

by Jarlve Tue Jun 26, 2018 7:11 am

Okay, thank you for the explanation.

The color of the HyperLink text remains black. Or is that because it was already clicked? Though it does not change back to its supposed color after restarting the webpage.

Using "SetGadgetColor(5,#PB_Gadget_FrontColor,RGB(0,0,255))" as workaround.
Jarlve
 
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

Re: Web page link

by Jarlve Tue Jun 26, 2018 7:26 am

Peter, my app uses a EditorGadget and it is possible to drag the HyperLink into the gadget which removes all of the buttons and shows this text in the Editor: http://127.0.0.1:9081/SpiderBasic_Compilation0.html
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest