Function overview
Prototype
webviewer_button (
content; textCol; bgCol )
Parameters
content Content to display. Eg : Text
textCol Text colour in CSS format. Eg : #ffeedd, abcdef or rgb(255,234,123);
bgCol bgCol <-- Background colour. See textCol examples.
Description
Tags:
webviewer layout calculation dynamic calculation button
This function returns an HTML content formatted for a webviewer. I use it to create simple buttons with calculated content. This function can also be use to display calculation on a layout such as a current record index display.
Examples
Sample input
webviewer_button ("Test"; "#FFFFFF"; "RGB(0,0,255)")
Sample output
<html>
<head> <style> html, body { height: 100%; width: 100%; } body { margin : 0px 0px 0px 0px; border : 0px; } table { border-collapse: collapse; width : 100%; height : 100%; } td { text-align: center; vertical-align : center; font-family : "Arial"; font-size : 75%; color:#ffffff; background-color: #0000dd; } </style> </head> <body>
<table><tr><td>
$$companyName = tf b</td></tr></table>
</body>
</html>
Function code
/*
Name :
webviewer_button
Description :
This function returns an HTML content formatted for a webviewer. I use it to create simple buttons with calculated content. This function can also be use to display calculation on a layout such as a current record index display.
Syntax :
webviewer_button (content; textCol; bgCol)
Parameters :
content <-- Content to display. Eg : Text
textCol <-- Text colour in CSS format. Eg : #ffeedd, abcdef or rgb(255,234,123);
bgCol <-- Background colour. See textCol examples.
Examples :
webviewer_button ("Test"; "#000000"; "RGB(0,0,0)")
webviewer_button (Get (RecordNumber) & " of " & get (foundcount); ""; "")
Creator :
Nicolas Bourré 20100303
*/
Let (
[
ltc = Length (textCol);
tc = Substitute (Case (ltc = 6; "#" & textCol; ltc = 7; textCol; ltc = 0; "#000000"; textCol); " "; "");
lbc = Length (bgCol);
bc = Substitute (Case (lbc = 6; "#" & bgCol; lbc = 7; bgCol; lbc = 0; "#ffffff"; bgCol); " "; "")
];
"data:text/html,<html>¶
<head>
<style>
html, body {
height: 100%;
width: 100%;
}
body
{
margin : 0px 0px 0px 0px;
border : 0px;
}
table
{
border-collapse: collapse;
width : 100%;
height : 100%;
}
td {
text-align: center;
vertical-align : center;
font-family : \"Arial\";
font-size : 75%;
color:" & tc & ";
background-color: " & bc & ";
}
</style>
</head>
<body>¶
<table><tr><td>¶"
& content &
"</td></tr></table>¶
</body>¶
</html>"
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/251
Prototype: webviewer_button( content; textCol; bgCol )
Function Author: El_Pablo (http://www.fmfunctions.com/mid/155)
Last updated: 05 March 2010
Version: 1.1
*/
// ===================================
/*__LITBR__Name :__LITBR__ webviewer_button__LITBR__Description :__LITBR__ This function returns an HTML content formatted for a webviewer. I use it to create simple buttons with calculated content. This function can also be use to display calculation on a layout such as a current record index display.__LITBR____LITBR__Syntax :__LITBR__ webviewer_button (content; textCol; bgCol)__LITBR____LITBR__Parameters :__LITBR__ content <-- Content to display. Eg : Text__LITBR__ textCol <-- Text colour in CSS format. Eg : #ffeedd, abcdef or rgb(255,234,123);__LITBR__ bgCol <-- Background colour. See textCol examples.__LITBR____LITBR__Examples :__LITBR__ webviewer_button ("Test"; "#000000"; "RGB(0,0,0)")__LITBR__ webviewer_button (Get (RecordNumber) & " of " & get (foundcount); ""; "")__LITBR____LITBR__Creator :__LITBR__ Nicolas Bourré 20100303__LITBR__*/__LITBR____LITBR__Let (__LITBR__[__LITBR__ ltc = Length (textCol);__LITBR__ tc = Substitute (Case (ltc = 6; "#" & textCol; ltc = 7; textCol; ltc = 0; "#000000"; textCol); " "; "");__LITBR__ lbc = Length (bgCol);__LITBR__ bc = Substitute (Case (lbc = 6; "#" & bgCol; lbc = 7; bgCol; lbc = 0; "#ffffff"; bgCol); " "; "")__LITBR__];__LITBR____LITBR__"data:text/html,<html>¶__LITBR__<head>__LITBR__<style>__LITBR____LITBR__html, body {__LITBR__height: 100%;__LITBR__width: 100%;__LITBR__}__LITBR____LITBR__body__LITBR__{__LITBR__margin : 0px 0px 0px 0px;__LITBR__border : 0px;__LITBR__}__LITBR____LITBR__table __LITBR__{__LITBR__border-collapse: collapse;__LITBR__width : 100%;__LITBR__height : 100%;__LITBR__}__LITBR____LITBR__td {__LITBR__text-align: center;__LITBR__vertical-align : center;__LITBR____LITBR__font-family : \"Arial\";__LITBR__font-size : 75%;__LITBR____LITBR__color:" & tc & ";__LITBR__background-color: " & bc & ";__LITBR__}__LITBR__</style>__LITBR__</head>__LITBR__<body>¶__LITBR__<table><tr><td>¶"__LITBR__& content &__LITBR__"</td></tr></table>¶__LITBR__</body>¶__LITBR__</html>"__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/251__LITBR____LITBR__ Prototype: webviewer_button( content; textCol; bgCol )__LITBR__ Function Author: El_Pablo (http://www.fmfunctions.com/mid/155)__LITBR__ Last updated: 05 March 2010__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
05 March 2010
how about centering the text vertically ?
( also your example writes black on black )
05 March 2010
I'll correct the example typo, when I'll figure out how to center vertically the content in the webviewer.