Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
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.
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
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?
Posts: 243
Threads: 15
Joined: Apr 2024
Reputation:
30
10-21-2025, 11:57 PM
(This post was last modified: 10-22-2025, 12:00 AM by ahenry3068.)
(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"
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
SWEET!
Thank you, @ahenry3068!
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
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.
Posts: 489
Threads: 17
Joined: Nov 2022
Reputation:
59
(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?
Posts: 489
Threads: 17
Joined: Nov 2022
Reputation:
59
(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.
Anyway thanks again for sharing @Pete
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
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
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
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.
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
10-29-2025, 04:17 AM
(This post was last modified: 10-29-2025, 04:18 AM by Pete.)
|