Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
putting a clickable hyperlink in your qb64pe program?
#1
Is there a way to do this? i.e., put a clickable link on a text screen or a graphic screen, that opens a URL in whatever the user's default browser is? 

Google seems to think there is a LINK command, e.g., 
Code: (Select All)
LINK "http://www.qb64.org"
but that just gets me a syntax error, and I'm not finding anything in the wiki or searching the forums, but maybe I'm doing it wrong.
Reply
#2
Primitive, but that should work. 
Thanks! 

PS Hey, didn't QB64PE get some networking functionality in the last few versions? I vaguely recall someone saying some http or tcpip functions were coming that would let you open a URL, or is that just me hallucinating & confusing dreams with reality?
Reply
#3
(10-21-2025, 11:35 PM)madscijr Wrote: Is there a way to do this? i.e., put a clickable link on a text screen or a graphic screen, that opens a URL in whatever the user's default browser is? 

Google seems to think there is a LINK command, e.g., 
Code: (Select All)
LINK "http://www.qb64.org"
but that just gets me a syntax error, and I'm not finding anything in the wiki or searching the forums, but maybe I'm doing it wrong.
Rho gave you the right answer.    In linux you want to precede the link with xdg-open http://mylink  for the shell target.  I use START also in Windows.   I actually use an OpenCMD$ and set it's value with 
         $IF WINDOWS THEN
                 OpenCmd$ = "START "
           $END IF

           $IF LINUX THEN 
                 OpenCmd$ = "xdg-open  "
           $END IF

           $IF MAC THEN
                 OpenCmd$ = "open "
            $END IF

SHELL OpenCmd$ + "http://mylink.to.here"
Reply
#4
SWEET! 

Thank you, @ahenry3068!
Reply
#5
And for you SCREEN 0 fans, a way using hardware acceleration to underline a link...

Code: (Select All)
Palette 7, 63: Color 0, 7: Cls
a$ = "https://qb64phoenix.com"
j = Len(a$)
Color 1: Print a$: Color 0
Print "Pete's tremendous while Steve's just amazing!"
CRed = 0: CGrn = 0: CBlu = 155
t = _NewImage((j + 1) * 8, 2 * 16, 32)
_Dest t
Line (0, _FontHeight * 1 - 3)-(j * _FontWidth, _FontHeight * 1 - 3), _RGB32(CRed, CGrn, CBlu), B
lin = _CopyImage(t, 33)
_FreeImage t
_Dest 0
Do
    _Limit 10
    _PutImage ((1 - 1) * 8, (1 - 1) * 16), lin
    _Display
Loop

Of course this can be expanded to detect links, follow link, as discussed in the posts above, and the underlining part could also be expanded into a sub or function to find the links on the screen and underline them.

Pete

- Helping the QB664 community one boast post at a time.
Reply
#6
(10-22-2025, 03:49 PM)Pete Wrote: And for you SCREEN 0 fans, a way using hardware acceleration to underline a link...

Code: (Select All)
Palette 7, 63: Color 0, 7: Cls
a$ = "https://qb64phoenix.com"
j = Len(a$)
Color 1: Print a$: Color 0
Print "Pete's tremendous while Steve's just amazing!"
CRed = 0: CGrn = 0: CBlu = 155
t = _NewImage((j + 1) * 8, 2 * 16, 32)
_Dest t
Line (0, _FontHeight * 1 - 3)-(j * _FontWidth, _FontHeight * 1 - 3), _RGB32(CRed, CGrn, CBlu), B
lin = _CopyImage(t, 33)
_FreeImage t
_Dest 0
Do
    _Limit 10
    _PutImage ((1 - 1) * 8, (1 - 1) * 16), lin
    _Display
Loop

Of course this can be expanded to detect links, follow link, as discussed in the posts above, and the underlining part could also be expanded into a sub or function to find the links on the screen and underline them.

Pete

- Helping the QB664 community one boast post at a time.

Whoa, that's so cool @Pete - so like it has textmode then overlays the image on top in the hardware layer?
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply
#7
(10-23-2025, 03:47 PM)grymmjack Wrote:
(10-22-2025, 03:49 PM)Pete Wrote: And for you SCREEN 0 fans, a way using hardware acceleration to underline a link...

Code: (Select All)
Palette 7, 63: Color 0, 7: Cls
a$ = "https://qb64phoenix.com"
j = Len(a$)
Color 1: Print a$: Color 0
Print "Pete's tremendous while Steve's just amazing!"
CRed = 0: CGrn = 0: CBlu = 155
t = _NewImage((j + 1) * 8, 2 * 16, 32)
_Dest t
Line (0, _FontHeight * 1 - 3)-(j * _FontWidth, _FontHeight * 1 - 3), _RGB32(CRed, CGrn, CBlu), B
lin = _CopyImage(t, 33)
_FreeImage t
_Dest 0
Do
    _Limit 10
    _PutImage ((1 - 1) * 8, (1 - 1) * 16), lin
    _Display
Loop

Of course this can be expanded to detect links, follow link, as discussed in the posts above, and the underlining part could also be expanded into a sub or function to find the links on the screen and underline them.

Pete

- Helping the QB664 community one boast post at a time.

Whoa, that's so cool @Pete - so like it has textmode then overlays the image on top in the hardware layer?

A fun thing to try would be a markdown parser/reader. Detecting links, making them clickable, formatting headings, bold, italic, etc. Smile

Anyway thanks again for sharing @Pete
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply
#8
Hey Gym, glad you found it useful.

I haven't had the time to code with it yet, but I do have a project I'm adding it to, which will do the things you mentioned.

Pete
Reply
#9
https://qb64phoenix.com/forum/showthread.php?tid=2480   <-- Hyperlinks in text and action words.   I don't want to copy resource files and such over again, so kindly take a moment and go to this old post and you'll see a working demo of this.
Reply
#10
@grymmjack

Posted my hyperlink demo here: https://qb64phoenix.com/forum/showthread...6#pid36826

Pete
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)