plc:plc_show_custom_message_box
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
plc:plc_show_custom_message_box [2019/05/17 09:21] – skirillov | plc:plc_show_custom_message_box [2019/05/17 11:20] – ivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Show Custom Message Box from PLC ==== | + | ===== Show Custom Message Box from PLC ===== |
- | In [[plc: | + | In order to create a custom popup window |
- | Global variables 9100-9163 are reserved to show/hide enumerated Popup message box. | + | 1. Press the **Create New** button in the Software PLC window |
- | Writing "1" to register (9100+N) will show Message Box #N on the main screen. Writing " | + | {{: |
- | Content for message box #0...#63 defined in cnc-variables.xml configuraton file by item **cnc-popup-message-0** ... **cnc-popup-message-15** | + | 2. Name your new window and press the **Confirm** button |
+ | {{:plc:002-custom-box-name.jpg}} | ||
- | <code xml> | + | 3. Click **Save** and **Build All** |
- | <value name=" | + | {{:plc:003-custom-box-save-build-all.jpg}} |
- | header=" | + | |
- | headerHeight=" | + | |
- | fontSize=" | + | |
- | timeout=" | + | |
- | </ | + | |
- | Message box contains 3 lines. Lines defined by attributes **header** (top line), **message** (middle line), **footer** (bottom line). Font size for each line defines by attributes **headerFontSize**, | + | At this point, the popup window' |
- | Line height for each line defined by attributes **headerHeight**, **height** and **footerHeight**. | + | 4. Copy and paste the following code into the window instead of the window' |
+ | < | ||
+ | main() | ||
- | Attributes **width** and **height** define message box width and height in pixels. | + | { |
- | Popup Messagebox will be automatically hidden if variable value was not changed longer than time defined in **timeout** attribute. | + | |
- | Parameter value can be printed in Message Box. To print a value - | + | do |
- | * Message attribute should contain C-style contains format line (ie " | + | { |
- | * Attribute **dest** should define variable number | + | |
- | * Attribute **K** defines scale ratio. | + | |
- | For example | + | if (portget(3)!=0) //Port 3 is used here. Use the actual port number for your particular setup |
- | * message=" | + | { |
- | * dest=" | + | gvarset(9101, |
- | | + | }; |
- | Variable #99 value multiplied by K-ratio will be printed: if variable value is 95000, value **95** will be shown. | + | }while(1); |
- | {{plc:mycnc-eco-popup-message-01.png}} | + | }; |
+ | </ | ||
+ | |||
+ | 5. In order to edit the newly created window, we can open CNC Settings > Screen > Popup Messages, and then press **Create New** | ||
+ | {{:plc:004-custom-box-save-popup-window-new.jpg}} | ||
+ | |||
+ | 6. Fill in the information regarding your new popup window and press the **Save** button. The Hide Timeout field is in seconds. | ||
+ | {{: | ||
+ | |||
+ | At this point, whenever the selected port will send a message | ||
+ | {{:plc:006-custom-box-popup-window-success.jpg}} | ||
+ | |||
+ | |||
+ | ====Deprecated version==== | ||
+ | [[plc: | ||
- | Source code to show Message Popup is | ||
- | <code c> | ||
- | gvarset(9100, | ||
- | portset(OUTPUT_OXY_HEAT_HI); | ||
- | timer=time_preheat; | ||
- | break_heating=1; | ||
- | //if the value will be clearen outside of PLC, abort Preheat procedure | ||
- | do { | ||
- | timer--; | ||
- | if (portget(6)!=0) // | ||
- | { | ||
- | timer=0; | ||
- | }; | ||
- | if (break_heating==0) | ||
- | { | ||
- | timer=0; | ||
- | }; | ||
- | if ((timer& | ||
- | { | ||
- | gvarset(99, | ||
- | }; | ||
- | | ||
- | gvarset(9100, | ||
- | </ | ||
plc/plc_show_custom_message_box.txt · Last modified: 2019/09/16 15:54 by ivan