Thursday, 4 April 2019

Fonts and links

Using the property inspector of livecode you can set many effects for your font:
Here the explanations:
  • textFont is the font used
  • textSize is the size of the fonr
  • textStyle can be:
    • bold
    • italic
    • underlined
    • boxed
    • 3D boxed
    • link
    • strikethrough
  • textAling is the alignof the text
  • fixedLineHeight is to permit or not the custom height of each line
  • textHeight is the distance between lines
  • margins is the distance of text from box around it
However you can mix  all styles using the htmlText property, for example if you have a field named label1 and put this code in a button:

on mouseUp
   put "<h1>Titolo 1</h1>" after temp
   put "<h2>Titolo 2</h2>" after temp   
   put "Questo e' un esempio di testo con piu' stili contemporaneamente. Ecco un elenco puntato:" after temp
   put "<ul>" after temp
   put "<li>primo elemento</li>" after temp
   put "<li>secondo elemento</li>" after temp
   put "</ul>" after temp
   put "Ecco un link: <a >www.livecode.com</a>" after temp
   set the htmltext of field "label1" to temp
end mouseUp

Clicking the button, you'll obtain this:

The link www.livecode.com is just text, to activate it you have to use the message linkCLicked, like this:

on linkClicked pLink
   launch url pLink
end linkClicked

The linkClicked will launch the browser to the url of the text of the link, so you can have different links on the same text and all will work correctly.

No comments:

Post a Comment