Sign in to follow this  
Followers 0
ct8356

Possible to define button size/position with equation?

11 posts in this topic

Is it possible to define the size and/or position of a button (or any icon) with an equation? For example, if I wanted to have four buttons along the bottom of the screen, I would like to be able to define button 2 a bit like this: button2_x_size = screen_x_size/4; //Set the width of button 2 to 1/4 of screen width. button2_y_size = screen_y_size/8; //Set the height of button 2 to 1/8 of screen height. button2_x_position = button1_x_size; //Set the x-position of button 2 to the right edge of button 1. button2_y_position = screen_y_size - button1_y_size; //Set the y-position of button 2 to the top edge of button 1. I would like it in equation form, so that if I decide to change the size and position of button 1, the size and position of button 2 will be updated automatically. (In fact, is it possible to simply write all the layout logic in some kind of text editor?) Edited by ct8356

Share this post


Link to post
Share on other sites
Not that I know of. But I am not familiar with what can be done in the script language.
1 person likes this

Share this post


Link to post
Share on other sites
Is it possible to modify the script language for a CX designer file?

Share this post


Link to post
Share on other sites
NS Macro command "MOVEPARTS" MoveParts.pdf
1 person likes this

Share this post


Link to post
Share on other sites
I think that you could use GETPARTS to determine the size of the button that you want to make the other buttons copy and then MOVEPARTS to change the size of the buttons.
1 person likes this

Share this post


Link to post
Share on other sites
Thank you for the advice. If I am working in CX Designer, where do I need to input this command?

Share this post


Link to post
Share on other sites
There are a three primary methods to access NS macros, "Project Properties", "Screen/Sheet Properties" and the "Macro" tab associated with screen objects. "Project Properties" -> "Macro" offers the most options to launch macros, "When Loading a Project", triggered by Alarm/Event and "On change of an address value" [This selection has 10 Boolean triggers and 10 Value triggers" Screen/Sheet macros can be launched when a screen is Opened, Closed or both Opened and Closed. Likewise screen object macros can be set for "Touch ON timing", "Touch OFF timing or both. Note that is you are using multifunction objects that launching macros is via the "Special" tab associated with the multifunction object. It is up to the developer to define the macro triggers and what macro should run. Have you downloaded and studied the NS Macro manual? It is a bit brief but should get you in the right direction. Edited by BITS N BYTES
1 person likes this

Share this post


Link to post
Share on other sites
This is a clip from the Macro Reference manual. This is found in the CX One Start menu (Omron > CX-One > CX-Designer > Manual).

Share this post


Link to post
Share on other sites
... just as Bits N Bytes stated. He beat me to it.

Share this post


Link to post
Share on other sites
I have tried writing MOVEPARTS(0,1,1); in the project property macro called "When loading a project". I hoped that this would move the label with ID "LBL0000" to position (1,1) when I press "Tools > Test > Start testing offline", or when I reload the project in CX Designer, but nothing happens... Am I misunderstanding something?

Share this post


Link to post
Share on other sites
Macros don't run very well in test mode. Use the physical NS.

Share this post


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
Sign in to follow this  
Followers 0