Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hyperlinks in Memo fields
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01666717
Message ID:
01667163
Views:
73
Wow, I didn't think there was anything I could teach Rick Strahl about VFP, but...

I decided to defer the Hyperlink idea to a later edition, and investigate using a HotKey to prompt the user for the link information.
----

>Heck I didn't know that VFP editor options has support for that. Huh learn something new every day.
>
>So we're talking about the FoxPro editor itself, not textboxes.
>
>IAC, that makes sense. A path on its own is not a URL and the option works off urls. Spaces are a problem but also the mnemonic prefix because otherwise it'd be real hard to figure out where the URL starts and ends. I assume the same is true if you have a valid HTTP url with spaces it'll also require the %20. For files the `file:///` prefix is key - i think it'll work with backslashes or forward slashes.
>
>+++ Rick ---
>
>
>>As an exmaple:
>>
>>CLOSE ALL 
>>
>>_vfp.EditorOptions = "K"+STRTRAN(_vfp.EditorOptions,"K","",1,1,1)
>>
>>CREATE CURSOR temp (test M)
>>APPEND BLANK
>>TEXT TO lcTest NOSHOW TEXTMERGE
>>This does NOT work.
>>C:\Program Files (x86)\Microsoft Visual FoxPro 9\qReadme.txt
>>
>>But, This does work.
>>file:///C:\Program%20Files%20(x86%29\Microsoft%20Visual%20FoxPro%209\qReadme.txt
>>
>>ENDTEXT
>>
>>replace test WITH lcTest
>>MODIFY MEMO test 
>>
>>
>>
>>I can (and probably will) have ON KEY LABEL to produce a GetFIle() (with a web site locator option) to add the URL to the memo. But the user will also want to cut-and-paste the URL directly into the text of the memo. It is this option that results in the first method not producing a hyperlink in the memo text. It's visual thing, not a physical hyperlink like a HTML Anchor tag. Something VFP provides naturally when the _VFP.EditorOptions contains a 'K'.
>>
>>>What I mean is how are you 'embedding' the hyperlink? As an anchor HTML tag or what? Are you writing raw HTML in the memo field?
>>>
>>>+++ Rick ---
>>>
>>>>>>I have investigating allowing the user to place hyperlinks in memo fields. Either linking to web pages or local files. The problem I have encountered is that if the path to local files contain spaces, the hyperlink does not work. My first thought was to encode the path with %20 for the spaces. But that seem not to work. Does any one have any suggestions how to format the links correctly.
>>>>>>
>>>>>>Thanks in advance.
>>>>>
>>>>>when you say embed hyperlinks what exactly do you mean? You mean put `a` html tag into the text?
>>>>>
>>>>>Local file links should work with spaces encoded as `%20` in the same way as Web HTTP links - I do this all the time in Help Builder. If you use full file paths that include a drive you might have to use syntax like this:
>>>>>
>>>>>file:///c:/somepath/subpath/my%20file.txt
>>>>>
>>>>>The slash direction of the path itself shouldn't matter though. Note that file links may hit security issues in certain browsers. I think FireFox may not load them if loaded from a Web page (you a `mark of the Web` header to get around this) while Edge/Chrome/IE load it. Also you can't load file links in AJAX requests that dynamically load content through code which is not allowed.
>>>>>
>>>>>
>>>>>+++ Rick ---
>>>>
>>>>I am using a MODIFY MEMO command, I have not tried it in an EditBox control yet. If the response is different, I may have to re-think my approach. I was hoping to keep the design simple. The Memo Window has all the natural features I need. If I take the EditBox method, I will have to add several ON KEY LABEL commands, and possibly other to match that the MODIFY MEMO provides normally.
>>>>
>>>>I idea is to provided the user a natural means to link to a file (or web site) inside a any text they are writing. The file could be either a text, Word, image, and anything on their network. When clicked, the file would open in their default viewer or editor.
Greg Reichert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform