Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

WindowAlignCalc ( SEE ARGUMENTS BELOW IN DESCRIPTION )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.5  (30 votes)
  Discuss this Custom Function

Jonathan Mickelson, Thought Development Corp.
http://www.thought-dev.com

Calculates window coordinates from a desired window size for easy placement relative to common FM application objects, including an active field for dynamic window orientation to the users cursor in a field.

Sample Input:
WindowAlignCalc ( "ActiveField" ; "TR" ; 200 ; 300 ; "TL" )
Sample Output:
200
300
305
517

(See Description for what each line represents)


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

NOTE!!! THIS FUNCTION IS CURRENTLY ONLY WORKS CORRECTLY FOR VERSION 9 AND BACKWARD. IT WILL WORK IN FM10 BUT WILL PROBABLY BE SHIFTED +/- 20-60 PIXELS BECAUSE OF THE
HORIZONTAL VS VERTICAL STATUS AREA, AND OS WINDOW EDGE DIFFERENCES.

SIMPLE CENTERING WILL STILL WORK PRETTY WELL WITHOUT ANY MODIFICATION.

Syntax
~~~~~~~~~~~~~~~
WindowAlignCalc ( refObjName ; refObjOrient.TMB_LCR ; newWinHeight ; newWinWidth ; newWinOrient.TMB_LCR )

Description
~~~~~~~~~~~~~~~
This function simplifies the calculation of window coordinates and sizes for simple window placement relative to common FM application objects. The "piece de resistance" being the ability to orient a new window easily upon ANY (*) 'active field' on a layout regardless of screen/window/field size or location. This is very powerful for pop-up calendars or help dialogs that need to that orient perfectly and dynamically upon a clicked field, based upon the orientations you define as parameters.

There are two layers to the calculation, between these two sets of calculations you can precicely place a window in countless configurations:
- The first is the "Reference Object" and the orientation which defines how you want the new window oriented in relationship to the referenced object.
- The second is the size and orientation of the "New Window" relative to the starting point defined by the "Reference Object" portion of the calculation.

(*) NOTE: If multiple copies of the same field exist on the layout results may be unpredictable. Usually the upper left field will be used by FM.

Output Format
~~~~~~~~~~~~~~~
A return delimited value list** of 4 values (in the order used by the Window Script step's input fields).
The output format and order of values is as follows (in pixels):

New Window Height
New Window Width
New Window distance from Top
New Window distance from Left

The best way to use this result would be to use:
"Middle Values ( WindowAlignCalc ( ******* ) 1 ; 1 )" or " 2 ; 1 )" or "3 ; 1 )" or "4 ; 1 )"
The Above Calculation will grab the appropriate value of the result which should then be placed into the appropriate input field of a New Window script step.

** NOTE: Output is returned as a return delimited value list because value functions don't strip a negative (-) from a value like Word functions do

Parameters
~~~~~~~~~~~~~~~
refObjName - The name of the object whose dimentions should be used to orient the new window relative to. This value is used by the "refObjOrient.TMB_LCR" parameter to determine where the start point for the new window should be calculated from.

The expected values are: screen - The Screen
desktop - The Desktop
window - The Active/Topmost Window (Default)
content - The Active Window's content area, does not include the Status area if open.
activeField - The field the user's cursor is currently clicked into on the active winow's layout.

refObjOrient.TMB_LCR - Two text characters each representing a vertical and a horizontal alignment orientation. They may be given in any order, as each character is unique. The default behavior for both is the middle/center options. For example, some common combinations of values would be "TL" for Top Left, "MC" for Middle Center.

The expected characters should be as follows:
Vertical : T = Top Horizonatal: L = Left C = Center R = Right
M = Middle (Default) (Default)
B = Bottom

newWinHeight - The desired fixed height, in pixels, of the new window being calculated. A value preceded by either a "-" or "+" will assign a window height relative to the original window's height, adjusted by the value given. For Example: a -50 value will result in a window's height the same as the original window minus 50 pixels.

newWinWidth - the desired fixed width, in pixels, of the new window being calculated. A value preceded by either a "-" or "+" will assign a window width relative to the original window's width, adjusted by the value given. For Example: a -50 value will result in a window's width the same as the original window minus 50 pixels.

newWinOrient.TMB_LCR - Two text characters each representing a vertical and a horizontal alignment orientation for the New Window relative to the start point already defined by the "refObj" parameters. Thus if the "refObj" returned a starting position of 100 Top and 100 Left, this parameter determines where the new window appears relative to that starting point. They may be given in any order, as each character is unique. The default behavior for both is the middle/center options. For example, some common combinations of values would be "TL" for Top Left, "MC" for Middle Center.

The expected characters should be as follows:
Vertical : T = Top Horizonatal: L = Left C = Center R = Right
M = Middle (Default) (Default)
B = Bottom

SPECIAL NOTES: Referencing the Screen Top will behave exactly the same as Desktop Top because because FMP doesn't allow negative vertical values and 0,0 is the desktop start dimension and behaves the same as -22, 0. Screen is still a referenceable object because Screen Middle/Centered dialogs end to look more naturally in the centerred on screen than Desktop Middle/Center ones.

Author - Jonathan Mickelson

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

There are no comments yet. Be the first to post a comment about this Custom Function! Please try to keep it brief & to the point. Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 7 + 9 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions