PDA

View Full Version : how to create a hyperlink



martin
16-04-2011, 10:14
Is there a way to create a hyperlink in thinbasic. I want to show a control (image or a label) and if the user click on this, it should open the hyperlink in user's default browser. Is that possible and how? Couldn't find this in the examples.

Martin

Petr Schreiber
16-04-2011, 11:58
Hi Martin,

there are (at least) two ways to do it. For labels, you can directly use TBURL32 control, which already looks as hyperlink. It is used for example in SampleScripts\UI\TextBox\TextBox.tBasic.

The second, more general way, is to shell default browser:


USES "OS"

OS_ShellExecute("open", "http://www.thinbasic.com", "", "", 1)
Petr

martin
16-04-2011, 13:25
Thanks a lot Petr, TBURL32 control is exactly what i was looking for! Is it also possible to change the text and URL, like "Control Set Text" ?

Petr Schreiber
17-04-2011, 10:35
Hi,

yes, it is possible. Just set the text following the same rules as for the creation (separate text and label using semicolon):


CONTROL SET TEXT hDlg, %ID_Url, "Visit Google;http://www.google.com"



Petr