LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Links in Text Box

While writing text into a text box I need some statements to be links to a *.pdf file. Is there a way te define links in a textbox? Is there any other customized control that can give me this functionality?
 
Thanks
0 Kudos
Message 1 of 5
(3,836 Views)

You can use a textbox or a listbox.  The link functionality isn't built in, but you can add it through callbacks.

Attached is a simple example which uses a textbox.

It uses GetTextBoxLineIndexFromOffset and GetTextBoxLine to read the textbox line that was clicked on.  It then checks for .pdf or http:// on the line, then launches the default application using the Windows SDK function ShellExecute.  If you don't have the SDK installed, you can use LaunchExecutable instead, but then you have to specify the application to open the file.

This example uses a timer because the textbox offset is updated after the leftclick event occurs.

For a real application, you probably need a more sophisticated parser, maybe by adding tags so the link can be imbedded within a line.  This simple example uses an entire lien as the link.

 

0 Kudos
Message 2 of 5
(3,813 Views)

Thanks. I checked it out. I think I should have rephrased my question to be "I need to display formatted text with embedded links (HTML). Does LabWindows provide any textbox like control that has this functionality?"

Edgar

0 Kudos
Message 3 of 5
(3,775 Views)
Hi Edgar,
 
It sounds like you are looking for something like a WYSIWYG in CVI. Unfortunately we do not have something like this.
 
However, you should be able to use Al S's example (or a slight derivation of) to accomplish what you want to do.
 
For instance, when using a callback, you could use the following:
 
Launch IE with www.mywebpage.com open:
LaunchExecutable ("Explorer.exe http://www.mywebpage.com");
 
To set the color of the textbox:
/*Programmatically set your textbox text colors to blue*/
SetCtrlAttribute (thisPanel, PANEL_TEXTBOX, ATTR_TEXT_COLOR, VAL_BLUE);
 
This will allow you to format your textbox to appear as you want while enabling you to open HTML links.
 
Hope this helps you out.
 
Matt M.
National Instruments
0 Kudos
Message 4 of 5
(3,746 Views)

I have found another example "C:\Program Files\National Instruments\CVI(version)\samples\userint\activex\WebBrowser.pr " that was very helpful.

Thanks for all your advice.

Edgar

0 Kudos
Message 5 of 5
(3,727 Views)