KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to programmatically change multi-style text attributes
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: March 17, 2012

When using multi-style text some users don't like to use the contextual menu to change the font styling. This tech tip will outline how to create buttons to change the style.



To accomplish this a helper method names apply style has been created.

C_POINTER($1;$textVar_p)
C_LONGINT($2;$attrVal_l)
C_LONGINT($start_l;$end_l)

If (Count parameters>=2)
  $textVar_p:=$1
  $attrVal_l:=$2
  GET HIGHLIGHT($textVar_p->;$start_l;$end_l)
  OBJECT SET STYLED TEXT ATTRIBUTES($textVar_p->;$start_l;$end_l;$attrVal_l;1)
End if


Each button of the UI will have the object method

apply style(->textArea;Attribute bold style)


Where the constant in the second parameter corrosponds to the expected function of the button.

For this to work correctly the Focusable option of the buttons must be unchecked from the Property List window.