Foundation 6

Fnd_Bttn

28 shared methods.

Fnd_Bttn_AlternativePicturePath

Fnd_Bttn_AlternativePicturePath {(Path)} --> Text

Foundation normally creates buttons based on icons in the Fnd_Bttn_Pictures folder within the component resource folder. This allows the developer to specify an alternative location for example in the host resource folder. Foundation will first of all check this location first and then the Fnd_Bttn_Pictures folder in component resoure folder

ParameterTypeDirectionDescription
inPathTextinThe Path (optional)
ResultTextoutThe path

Fnd_Bttn_Cache_Image_Add

Fnd_Bttn_Cache_Image_Add (composite name; image)

Adds an image to the RAM cache of button images.

ParameterTypeDirectionDescription
compositeNameTextinThe name returned by the Fnd_Bttn_GetPictureName function
imagePictureinThe picture to add to the cache

Fnd_Bttn_Cache_Image_Delete

Fnd_Bttn_Cache_Image_Delete (composite image name)

Deletes an image from the cache using its composite name as the key.

ParameterTypeDirectionDescription
compositeNameTextinThe image name returned by Fnd_Bttn_GetPictureName

Fnd_Bttn_Cache_Image_Get

Fnd_Bttn_Cache_Image_Get (composite name) --> Picture

Returns an image from the cache using its composite name.

Modified from Mark's original design. This routine no longer displays an alert

if the image isn't found in the cache. It just returns a blank image, so the

developer needs to check to see if an image was returned.

ParameterTypeDirectionDescription
nameTextinThe name returned by the Fnd_Bttn_GetPictureName function
ResultPictureoutThe image from the cache

Fnd_Bttn_Cache_Startup

Fnd_Bttn_Cache_Startup

These arrays keep track of those Rollovers we've created in the application. We will only be rollovers as well need them, then not creating the picture again. This allows us to easily switch languages and have all the text in the rollovers be easily converted without storing loads of pictures in different languages.

No parameters.

Fnd_Bttn_CacheMaximumSize

Fnd_Bttn_CacheMaximumSize {(New Cache size)} --> longint

Allows you to get and set the maximum cache size The default (and minimum) is 2 MB (2048*1024)

ParameterTypeDirectionDescription
inNewCacheSizelongintinThe new cache size
ResultlongintoutThe cache size

Fnd_Bttn_ColorToString

Fnd_Bttn_ColorToString (rgb color) --> Text

Converts a 4D RGB color value to a CSS2-compatible string in the format "#rrggbb".

ParameterTypeDirectionDescription
colorLongintinThe 4D RGB color
ResultTextoutThe color string

Fnd_Bttn_CreateBackgrounds

Fnd_Bttn_CreateBackgrounds

Because of the time to do the picture maths for the middle bit of the button, we

will pre-build different sized middle slices and store them in an array.

No parameters.

Fnd_Bttn_CreateButton

Fnd_Bttn_CreateButton (->button object; ->picture variable; icon name; label)

Helps the developer create and size a picture button created with the Foundation Buttons component.

Creates the image needed from the icon name and label, assigns it to the picture variable, then assigns the picture variable to the button.

ParameterTypeDirectionDescription
buttonPointerinThe form button object
picturePointerinA picture variable
iconNameTextinAn icon name
labelTextinAny text

Fnd_Bttn_GetIcon

Fnd_Bttn_GetIcon (name{; state}) --> Picture

This method just wraps the GET PICTURE FROM LIBRARY command, but if you wanted to store your pictures in resources or some other way, you could modify this command for getting the pictures.

ParameterTypeDirectionDescription
inIconNameTextinThe picture name
inStateTextinThe icon state: "selected" or "disabled" (optional)
ResultPictureoutThe picture

Fnd_Bttn_GetPicture

Fnd_Bttn_GetPicture (icon name; button label{; variation}) --> Picture

This routine returns a picture of a rollover based on the parameters you pass for the icon, text, size and type. If the picture already exists in the Cache, it is retreived from there instead of being generated again.

Supports these variations: "current" : The currently selected button (Mac OS X Prefs style)

ParameterTypeDirectionDescription
inIconNameTextinThe name of the icon to use from the 4D picture library
buttonLabelTextinThe label for the button
inVariationTextinThe variaton name (optional)
ResultPictureoutA picture to use for a 4D picture rollover button

Fnd_Bttn_GetPictureName

Fnd_Bttn_GetPictureName (icon name; label{; variation}) --> Text

Creates a composite name for the picture which will be used to

reference it quickly in the cache.

ParameterTypeDirectionDescription
iconNameTextinThe button icon name
buttonLabelTextinThe button label name
inVariationTextinThe variaton name (optional)
ResultTextoutThe cache picture name

Fnd_Bttn_GetPictureWidth

Fnd_Bttn_GetPictureWidth (icon; text{; variation}) --> Number

Returns the width of the rollover picture that uses the specified icon and text.

ParameterTypeDirectionDescription
inIconNameTextinThe name of the icon
buttonLabelTextinThe button label
variationTextinThe button variation ("current" or "menu")
ResultLongintoutThe width of the picture button.

Fnd_Bttn_GetSizedIconName

Fnd_Bttn_GetSizedIconName (icon name) -> Text

Returns the name of the icon with the size embeded.

ParameterTypeDirectionDescription
inIconNameTextinThe icon name without the size
ResultTextoutThe icon name with the size

Fnd_Bttn_Info

Fnd_Bttn_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

ParameterTypeDirectionDescription
requestTextinInfo desired ("version" or "name")
ResultTextoutResponse

Fnd_Bttn_LibraryToResource

Fnd_Bttn_LibraryToResource

Takes all the pictures in the 4D Picture Library and writes them to a separate .png file for each picture in the library in the 4D Resources folder in a folder named Fnd_Bttn_Pictures.

Used by Fnd_Bttn subcomponent to allow developer to easily edit or replace the icons used throughout Foundation.

Special thanks to John Craig for this implementation.

No parameters.

Fnd_Bttn_MakeBackground

Fnd_Bttn_MakeBackground (width) --> Picture

Builds a button background to the specified width.

ParameterTypeDirectionDescription
inWidthLongintinThe width needed
ResultPictureoutThe buton background image of the right width

Fnd_Bttn_MakeButton

Fnd_Bttn_MakeButton (icon name; button label; variation) --> Picture

Returns a picture of the button * 4 for use as a 4D picture button.

Assumes the button style has been previously defined.

This isn't called directly. Call Fnd_Bttn_GetPicture. It will check the cache first, then call this only if necessary.

Supports these variations: "" : A standard button "current" : The currently selected button (Mac OS X Prefs style) "menu" : Adds a menu indicator triangle

ParameterTypeDirectionDescription
iconNameTextinThe name of the icon to use from the 4D picture library
buttonTextTextinThe label for the button
variationTextinThe variation name
ResultPictureoutA picture to use for a 4D picture rollover button

Fnd_Bttn_MakeCrntBackground

Fnd_Bttn_MakeCrntBackground (width) --> Picture

Returns the background to use with the currently selected "Pref" style button.

Similar to Fnd_Bttn_MakeBackground, but designed for the background of the currently selected button (Mac OS X Prefs style).

This routine also isn't as optimized as Fnd_Bttn_MakeBackground.

ParameterTypeDirectionDescription
inWidthLongintinThe required width of the background
ResultPictureoutThe background picture

Fnd_Bttn_MakeIconPicture

Fnd_Bttn_MakeIconPicture (icon name) --> Picture

Creates a picture containing the 4 icons arranged for the rollover button,

spaced according to the button height.

ParameterTypeDirectionDescription
iconNameTextinThe name of the icon
ResultPictureoutA picture of the icon over the background

Fnd_Bttn_MakeMenuIndicatorPic

Fnd_Bttn_MakeMenuIndicatorPic --> Picture

Creates a picture of the specified label.

No parameters.

Fnd_Bttn_MakeTextPicture

Fnd_Bttn_MakeTextPicture (button label) --> Picture

Creates a picture of the specified label.

ParameterTypeDirectionDescription
buttonTextTextinThe label for the button
ResultPictureoutA picture of the label (x4)

Fnd_Bttn_Platform

Fnd_Bttn_Platform ({platform name}) --> Text

Sets and gets the toolbar platform name.

Can be: "Win" "Mac" "Auto" Only "Mac" or "Win" will be returned.

ParameterTypeDirectionDescription
requestedPlatformTextinThe platform to use (optional)
ResultTextoutThe selected platform

Fnd_Bttn_SetBackgroundPict

Fnd_Bttn_SetBackgroundPict (left, middle, right{; pref left; pref middle; pref right})

Call this to specify the images to use for the button background.

ParameterTypeDirectionDescription
leftPictureinThe left edge of the button
middlePictureinThe middle of the button (generally 1 pixel wide)
rightPictureinThe right edge of the button
selectedLeftPictureinThe left edge of the currently selected button (optional)
selectedMiddlePictureinThe middle of the currently selected button (optional)
inSelectedRightPictureinThe right edge of the currently selected button (optional)

Fnd_Bttn_SetTextProperties

Fnd_Bttn_SetTextProperties (font name; font size; font style)

Sets the text properties for the button labels.

ParameterTypeDirectionDescription
fontNameTextinThe font name
fontSizeLongintinThe font size
fontStyleLongintinThe font style (use 4D constants)

Fnd_Bttn_SetVariables

Fnd_Bttn_SetVariables

Updates the toolbar variables depending on the current platform, size, and style settings.

No parameters.

Fnd_Bttn_Style

Fnd_Bttn_Style ({Style name}) --> Text

Sets and gets the toolbar style name.

Can be: "Large" "Prefs" "Small1" "Small2"

ParameterTypeDirectionDescription
requestedStyleTextinThe style to use (optional)
ResultTextoutThe selected style

Fnd_Bttn_TextToPict

Fnd_Bttn_TextToPict (text;fontName;fontSize;fontFace;width;height{;color}) --> Picture

Converts a text string to a picture of the text.

ParameterTypeDirectionDescription
textTextinText to make into picture
ResultPictureoutA picture of the text