KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieving the Reference of a Style Sheet in 4D Write
PRODUCT: 4D Write | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: March 30, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When using 4D Write, you may want users to be able to modify/create/delete style sheets. The consequence of that is that the style sheet reference number may change over time. Using 4D Write's language, you can retrieve the reference of any given style sheet. All you need to know is its name. The following piece of code displays the reference number of the style sheet named "MyStyleSheet", in the area "Field3".

ARRAY STRING(31;$StyleSheetName;WR Count (Field3;wr nb stylesheets ))
$StyShCount:=WR Count (Field3;wr nb stylesheets )
For ($i;1;$StyShCount)
WR GET STYLESHEET INFO (Field3;$i;$Name;$applyTo;$protected;$shortcut)
$StyleSheetName{$i}:=$Name
End for
$StyleSheetRef:=Find in array($StyleSheetName;"MyStyleSheet")
ALERT(String($StyleSheetRef))