The development of a pseudo (or simulated) hyperlink in Liberty Basic came about in response to a query posted by Ilmar. He asked: Is it possible to add a link to a URL in a statictext control. Like the blue&undelined stuff I've seen?
David Conner and Stefan Pendl, working as a team managed to develop an very acceptable alternative to the native windows control, written using Liberty Basic with a few API calls thrown in. The program was developed in stages, based on the initial posting by David.
This is the final product, showing a hyperlink that will cause the mouse pointer to change to a hand and the link to change colors as you pass the pointer over it. A job well done.
Screenshot
Demo
' Demo of clickable text' by David Conner, 2004, public domain''Cursor Example by Mitchell Kotler'How to use LoadCursor and SetCursor to access more Window's Cursors'No more flickering!'modified Nov 26, 2000 awatson'modified Jan 07, 2004 s.pendl'modified Jan 08, 2004 s.pendlNoMainWinWindowWidth=400:WindowHeight=400UpperLeftX=int((DisplayWidth-WindowWidth)/2)UpperLeftY=int((DisplayHeight-WindowHeight)/2)Stylebits#1.g,0, _WS_BORDER,0,0Graphicbox#1.g,100,100,85,25statictext#1.txt," to open LB home page",185,106,200,25Open"Clickable Text"for window_nf as#1#1.g "when leftButtonDown [checkClick]"#1.g "when mouseMove [changeCursor]"#1"Trapclose [quit]"#1.g "down; fill buttonface; color black; backcolor buttonface"#1.g "font times_new_roman 12 underscore bold"#1"font times_new_roman 12 bold"#1.g "place 10 21"#1.g "\Click Here"#1.g "flush"call setClass hwnd(#1)Wait[quit]Close#1:End[checkClick]run"explorer http://libertybasic.com"wait[changeCursor]
x =MouseX
y =MouseYif x >5and y >5and x <80and y <20then
IDC.HAND =32649
CursorHandle=LoadCursor(IDC.HAND)#1.g "color blue ;place 10 21 ;\Click Here"elsecursor normal
#1.g "color black ;place 10 21 ;\Click Here"endifwaitfunction LoadCursor(CursorName)calldll#user32,"LoadCursorA",_
Instance Asulong,_
CursorName Asulong,_
hCursor Asulongcall SetCursor hCursor
LoadCursor = hCursor
endfunctionsub SetCursor hCursor
calldll#user32,"SetCursor",_
hCursor asulong,_
result asulongendsubsub setClass hWnd
index = _GCL_HCURSOR or0
value =0calldll#user32,"SetClassLongA",_
hWnd asulong,_
index asulong,_
value asulong,_
result asulongendsub
Simulated Hyperlink in Liberty Basic
Originally published in NL 129by David Conner and -
Simulated Hyperlink in Liberty Basic | Clickable Link | Screenshot | Demo
Clickable Link
The development of a pseudo (or simulated) hyperlink in Liberty Basic came about in response to a query posted by Ilmar. He asked: Is it possible to add a link to a URL in a statictext control. Like the blue&undelined stuff I've seen?
David Conner and Stefan Pendl, working as a team managed to develop an very acceptable alternative to the native windows control, written using Liberty Basic with a few API calls thrown in. The program was developed in stages, based on the initial posting by David.
This is the final product, showing a hyperlink that will cause the mouse pointer to change to a hand and the link to change colors as you pass the pointer over it. A job well done.
Screenshot
Demo
Simulated Hyperlink in Liberty Basic | Clickable Link | Screenshot | Demo