Brian Dunning's FileMaker Custom Functions

CenterWindow in Window vert horiz ( demension )

Center Window in Window

  Average rating: 4.6 (30 votes) Log in to vote

Todd Dignan   Todd Dignan
Dignan Consulting Inc
http://www.dignanconsulting.com

Share on Facebook Share on Twitter

  Sample input:
CenterWindow in Window vert horiz (vert) or CenterWindow in Window vert horiz (horiz)
  Sample output:
Center the window vertically basis on the info the custom function WindowInfo gathered. Also when the horiz pram is used the window widow will center horizontally.

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This should be used with the "WindowInfo" custom function. (which gathers a windows, height, width, top and left px in global vars.) Call "WindowInfo" custom function first in a script before using this custom function. You will want to use "CenterWindow in Window vert horiz" custom function in a script step GTRR, Move/Resize Window or New Window. In these script steps you will want to place the custom function in the field "Distance from top" CenterWindow in Window vert horiz (vert) and the field "Distance from Left" CenterWindow in Window vert horiz (horiz). This will center the current window in the window info gathered by the custom function "WindowInfo". I hope this makes sense.


 

Comments

Andrew   Andrew, Austin
Oct 24, 2012
I like it, but it doesn't work for me.

my script has:
SetVariable [ $windowInfo; Value:WindowInfo_CF]
NewWindow [Height: 450; Width:630; Top: CenterWindow_CF("vert"); Left: CenterWindow_CF("horiz"); Style: Dialog]

It appears that left and top are set to 0.
 
Todd Dignan   Todd Dignan, Los Osos, CA
Oct 25, 2012
Hi Andrew,

I think you posted this comment in the wrong custom function. Is custom function is call "CenterWindow in Window vert horiz" not CenterWindow_CF.

Stephen Dolenski do have a custom function name "cf_CenterWindowLeft" and cf_CenterWindowTop. Anyway, if you did want to use this CF you would need to use in conjunction with this CF the CF name "WindowInfo" found at http://www.briandunning.com/cf/1383.

I hop this helps.

Todd Dignan
 
ron   ron, idaho
Oct 29, 2012
I used this function after WindowInfo. (I can see the $$ variables). I used it in Window Resize but it doesn't 'move' the window to a centered location. Huh?
 
Todd Dignan   Todd Dignan, Los Osos, CA
Oct 29, 2012
Hi Ron,

It was designed to center a window within a window. The WindowInfo function get the info of the window you want to center the a new or existing window in. Can you send the script(s) that are calling the functions.
 

Log in to post comments.

 

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

Under construction. Email me your wish list for improvements.