Jump to content

Recommended Posts

Good day,

I am trying to center a "Floating Window" using the new windows command, i want to accomplish one of two objectives.

1- Open the new windows to the right of the "button" that triggers the script 

To do this i am using the "GetLayoutObjectAttribute( "VendorWindows" ; "Top" ), and "GetLayoutObjectAttribute( "VendorWindows" ; "Left" )

2- Open the new window in the center of the screen

To do this i am using "Get ( ScreenWidth ) /2" and "Get ( ScreenHigh) / 2"

But i cant get either way to work.

Both option i am entering it in the "New windows" function  

What am i doing wrong. 

Thanks

JMart

Link to post
Share on other sites
1 hour ago, JMart said:

What am i doing wrong. 

Hard to say without seeing exactly what you did. Also the description "i cant get either way to work" is pretty useless. Tell us how it fails.

The only thing that jumps out is this: if you want to open a floating window to the right of the button, then you should specify its position from left as =

GetLayoutObjectAttribute ( "YourButtonObjectName" ; "right" )

Oh, and also, if you want to center the window, you must subtract half of its intended width from the screen center in order to get its position from left. Likewise for the vertical dimension.

 

Edited by comment
Link to post
Share on other sites

Thanks for the reply,

User Click on the icon next to "Vendor"

image.png.68697de1f40f4ccb1e7390d7ea4c5b24.png

Once presses a script is executed 

image.png.2b17e7d58edadf00fbdc67478a74ddc8.png

Windows will appear on the same location every time 

image.thumb.png.8a2cf5a480150d07eae4c58a5bd4b46f.png

Link to post
Share on other sites

I am afraid I am not able to reproduce the problem you describe. The only thing I can think of is that your button's object name is not "VendorWindow".

Does the attached demo work as expected for you?

NewWindowPos.fmp12

Link to post
Share on other sites

Night, I think i figured out the issue i was having, the reason is my button was not a button but a Button Bar. I recreated it to a button and its working fine.

 

Thanks for the help

 

Link to post
Share on other sites
1 hour ago, JMart said:

the reason is my button was not a button but a Button Bar.

I don't see why this should be a problem (see attached).

Note that a button bar is an object by itself and so are the individual buttons. The only way I was able to reproduce a behavior similar to what you describe was when neither the bar nor any of its buttons had an object name equal to the one used by the script.

 

NewWindowPos2.fmp12

Edited by comment
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.