ModeFile - How to make a clickable, highlighted object

StrongED highlights such URLs as (but not in HTML mode!) and if you click on it the URL will be launched. similarly anything starting http:// is highlighted and clickable as a URL. However is not recognised as a URL so is neither highlighted nor clickable. How to make so?

Highlighting is totally separate to making a word clickable so this would require two different sections of the ModeFile to be altered.


Hightlighting has limitations. StrongED can only highlight the rest of the item following the recognised bit. So I can only make this work by recognising a bit that is common to all my sub-domains - i.e. the bit. How to do this is explained in the Syntax of a ModeFile but what I did was to include in the BaseMode Modefile, SyntaxWords section the line
SyntaxWords Group6 EndOfExpr ee_url nocase
As you save the edited ModeFile, StrongED parses it and warns you if it does not make sense. If you have done this correctly it now works, colouring the URL from the bit to the following space (that's what EndOfExpr does). Now you can open the Mode's Choices -> Colours, click on the Element Menu -> Group 6 and select foreground and background colours to choice.

Unfortunately you cannot make the full URL highlighed as the highlighting system recognises words starting with a listed part.


We can however make the full URL launchable as such strings are recognised by the same syntax as is used in advanced search. We have to define a named seach expression which will find the part we want to be clickable. In my case I used
	torg		{~"" (\a | ".")}+ ""
which I added to the Search section of the BaseMode Modefile which already contains defined expressions such as ee_url, http etc.

Now we need to broadcast it. In the section ClickList Select2 I added

	torg	BroadcastURL("http://")
which adds http://to the string found by torg and launches it.

Was this page helpful? Please email me and/or rate this page:

If you want a reply make sure any email address will not get spam-binned!
Optional comment

Other relevant pages

Top of page

Page Information Document URI:
Page first published Wednesday 19th of September 2018
Last modified:Wed, 17 Jul 2019 14:34:35 BST
© 2018 - 2024 Richard Torrens.