Page 1 of 1

Web page link

Posted: Mon Jun 25, 2018 8:38 am
by Jarlve
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.

Re: Web page link

Posted: Mon Jun 25, 2018 9:38 am
by Peter

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

Re: Web page link

Posted: Tue Jun 26, 2018 6:43 am
by Jarlve
Wonderful. Thank you very much Peter.

The ! indicate inline JS?

Re: Web page link

Posted: Tue Jun 26, 2018 6:55 am
by Peter
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

Re: Web page link

Posted: Tue Jun 26, 2018 7:11 am
by Jarlve
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.

Re: Web page link

Posted: Tue Jun 26, 2018 7:26 am
by Jarlve
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