'''Table of contents: '''
# =====Introduction# Control styles# Control attributes# Main Window attributes# Bitmap types and Alpha and locations=====
Video: [https://www.youtube.com/watch?v=uQWDttzKuDA https://www.youtube.com/watch?v=uQWDttzKuDA]
=====Introduction===== Video{{#ev: [https://www.youtube.com/watch?v=l6d_AYTptVQ https://www.youtube.com/watch?v=l6d_AYTptVQ]|uQWDttzKuDA}}
'''Features include:'''
Some more advanced features include input fields, C program actions, label DROs. Load the addition example in the screen editor. Example contains two user input controls and one DRO label control. The input edit controls are associated with KFLOP persist variables 160 and 161. The DRO label is associated with KFLOP persist variable 162. The Add button is configured for screen script action to run a C program in KFLOP. The C program is contained in the file “Add.c”. Test it by entering two values and pushing the Add button. Now open KMotion and look at the simple C code that is behind the function. (Open the file “Add.c”).
'''=====Momentary and Toggle button types in KMotion CNC Screen Editor'''=====
[https://www.youtube.com/watch?v=eE2mSUXxN2M https://www.youtube.com/watch?v=eE2mSUXxN2M]
{{#ev:youtube|eE2mSUXxN2M}}
Start KMotion CNC Screen Editor, and click on the “Main” tab, then on “Read Script” and choose the file named MomentaryToggle.scr
[[File:Momentary-button-2.png|none|link=]]
Clicking the Momentary button activates the bit; releasing it,deactivates it. Clicking the Toggle button once sets the bit; clicking it again releases it. =====Combo Box Control with Drop Down Lists in KMotion CNC Screen Editor=====[https://www.youtube.com/watch?v=Pp5DPfn8GLI https://www.youtube.com/watch?v=Pp5DPfn8GLI] {{#ev:youtube|Pp5DPfn8GLI}} Combo Box Controls allow the Operator to select text items from a list. The list items are specified as semicolon separated strings in the Text Property for the Control. Combo Boxes are read in the same Manner as Edit Controls where the Var Parameter of the Control is used to request the contents of the Control. When KMotionCNC detects a non-zero value of the persist variable it uses the value as an offset into the Gather Buffer and places the selected text into the Gather Buffer. KFLOP also maintains an EditChangeCount value which is incremented each time any Edit or ComboBox Control changes. See the ComboBoxCopyToDROLabelwhenChangedUnicode.c Example. ComboBox Selections made by the Operator are maintained from one KMotionCNC Session to the next using a Disk file:\KMotion\Data\EditControlPersist.txt
=====Dual Button Types in KMotion CNC Screen Editor=====
[https://www.youtube.com/watch?v=8dAEeGnLaRg https://www.youtube.com/watch?v=8dAEeGnLaRg]
{{#ev:youtube|8dAEeGnLaRg}}
'''Instantaneous Feed Rate Display'''Certain buttons connected to internal status modes display one of 2 bitmaps depending on the state. Such as the Cycle Start Button displays either a Play image or a Halt image dependent on whether a Job is running. The 2 bitmaps can be reassigned to override the default images.
=====Instantaneous Feed Rate Display=====
[https://youtu.be/w-bKvqXCd0Q https://youtu.be/w-bKvqXCd0Q]
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid heal explore (?) at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct {{#ev:youtube|[https://youtu.be/w-bKvqXCd0Q w-bKvqXCd0Q]}}
Normally the feed rate indication in KMotionCNC shows ''average'' feed rate over 100ms, assuming straight line motion. Here we use a C program to calculate a more instantaneous rate and display it on the KMotionCNC screen using the KMotionCNC screen editor. Here the C program samples two positions and times, computes the delta position and the delta time, formats it to a string and displays it onto DRO label 162 in KMotionCNC and it performs this action roughly every one ½ seconds. Here is the screen script for the screen shown on the left, we’ve added a type DRO label in the screen editor, edited colors and it is connected to persist variable 162. This job consist of a rapid helix bore at a rate of about 6 revolutions per second. It shows the instant feed rate being more correct.
'''Split/Full/Hidden GViewer Display on Main Dialog Face'''There is a newer example which also displays the feed rate as a vertical bar graph. See:
ShowInstantFeedRate3AxisBar.scr and related C Program ShowInstantVelocityDROBar.c
=====Split/Full/Hidden GViewer Display on Main Dialog Face=====
[https://youtu.be/VkBhYpyGpNU https://youtu.be/VkBhYpyGpNU]
KMotionCNC Screen Editor supports changing main screen style. New Boolean Screen Script “Main{{#ev:” Options: "Caption:" "MaxBox:" "MinBox:" "ResizeFrame:" "Maximize:"youtube|VkBhYpyGpNU}}
=====Using Resizeable/Floating GViewer Control with Custom Screen=====
Normally with a Custom Screen the GViewer Plotting is sent to the GViewer Control on the Main Dialog Face and the floating/re-sizable GViewer window is not used. It is normally closed and the GViwer Button to open it is hidden. However if it is desired to use the floating/re-sizable GViewer window rather than the Control on the Main Screen (which is hidden), this can be accomplished by setting the Var parameter for the Main Screen GViewer Control (IDC_viewctrl) to 0. Non-zero values will direct the Plotting to the GViewer Control on the Main Dialog Face.
'''Maximized Captionless KMotionCNC Screens'''
=====Main Screen Style=====
KMotionCNC Screen Editor supports changing main screen style. See the Main Dialog Screen Option under the Main Tab. Boolean Screen Script Options: "Caption:" "MaxBox:" "MinBox:" "ResizeFrame:" "Maximize:"
=====Maximized Captionless KMotionCNC Screens=====
[https://youtu.be/R44F0_upIoA https://youtu.be/R44F0_upIoA]
{{#ev:youtube|R44F0_upIoA}}
New option in KMotionCNC Screen Editor V4.34e allows screens to be maximized to full screen and with or without Window Frame/Title. New options in Screen Editor: turn minimum box on or off, maximum box on or off, resizing frame on or off. Caption on top can be present or absent.
* '''X, Y<br /> '''Changes the horizontal and vertical position of the control.
* '''Width, Height'''<br /> Changes the size of the control.
* '''Script'''<br /> Using this field, the user has three options:shown below.<br /><br />
Video demonstration of the creation of Screen Script to perform Windows Messages
{{#ev:youtube|9x4JTswwWvk}}
=====Control Script Options=====
a) Selecting a screen script file from the library:
=====Bitmap types, Alpha, and locations=====
<br />The following bitmap types are supported: .bmp, .gif, and.png. Out of these, only the png file type supports alpha channels, i.e. background transparency.<br />Images are stored in the following “Resources” location:<br />\KMotion434i\PC VC Examples\KMotionCNC\res
=====Motion Buttons (for Jogging)=====
Special Buttons for Jogging exist with Style MotionButton. Although these buttons can be customized with regard to Bitmap images, size, positions, Font, ToolTips, Show/Hide, and Hotkeys they have fixed functionality for the 6 GCode Axes XYZABC. They support momentary Hotkey and combined mouse operation with the ability to have multiple Hotkeys pushed simultaneously and dynamically change speed using the SHIFT key. Additional MotionButtons can not be currently added.
[[File:MotionButtons.png|none|link=]]
The Jog Buttons are grouped into 6 buttons per axis. 3 of the 6 buttons are used for moving one direction and 3 for the other direction. The 3 buttons correspond to Stepping a fixed distance, Jogging slow, and Jogging Fast. The Resource IDs corresponding to each axis are:
'''X + = IDC_RightStep, IDC_Right, IDC_Right2'''
'''X - = IDC_LeftStep, IDC_Left, IDC_Left2'''
''' '''
'''Y + = IDC_UpStep, IDC_Up, IDC_Up2'''
'''Y - = IDC_DownStep, IDC_Down, IDC_Down2'''
''' '''
'''Z + = IDC_ZplusStep, IDC_Zplus, IDC_Zplus2'''
'''Z - = IDC_ZminusStep, IDC_Zminus, IDC_Zminus2'''
''' '''
'''A + = IDC_AplusStep, IDC_Aplus, IDC_Aplus2'''
'''A - = IDC_AminusStep, IDC_Aminus, IDC_Aminus2'''
'''B + = IDC_BplusStep, IDC_Bplus, IDC_Bplus2'''
'''B - = IDC_BminusStep, IDC_Bminus, IDC_Bminus2'''
'''C + = IDC_CplusStep, IDC_Cplus, IDC_Cplus2'''
'''C - = IDC_CminusStep, IDC_Cminus, IDC_Cminus2'''
'''Note the HotKeys for all 3 Motion Buttons for each axis/direction must be set to the same value.''' This is because the same HotKey combined with CTRL and SHIFT alter the behavior to Step and Fast respectively. If not all 3 buttons are desired for the screen the others may be hidden but should be all defined to the same HotKey for the HotKey functionality to work correctly. Furthermore no other buttons should be defined with the same HotKeys. The Screen Editor has a special feature to test for Duplicate HotKey assignments called "check dup hotkey"
There is also one associated IDC_StopStep button which will stop any Step Movement currently in progress.
=====Performing an action Immediately within Screen Script=====
Normally when processing a Screen Script, the "Script" Parameter defines for a Push Button Control what should happen when the Push Button is pushed. However when a "Script" Parameter is specified for a static Label the Action will occur immediately after the Screen Script is processed.
For example: when loading a screen intended for Simulation we might want to have the Simulation mode automatically selected on. So the Script for the IDC_SimulateStatic Label might be set to check the simulate checkbox with:
WinMsg:DlgName;IDC_Simulate;BM_SETCHECK;BST_CHECKED
=====Scaling an Entire Screen or Portion of a Screen=====
A new Screen Editor feature has been added to stretch/shrink a number of selected screen controls by a specified percentage. The height and width of the controls can be stretched as with their XY positions. The horizontal and vertical directions can be Stretched/Shrunk independently. Scaling the Vertical direction will also scale any Font point settings. The Width and Height of the entire dialog will also be scaled accordingly.
To Scale a Screen:
# Select the controls to be scaled - usually all controls (drag a box to select multiple controls)
# Select mode: Screen Scale
# Select the desired Size Change as a percentage 1-100% (ie 60% corresponds to a stretch/shrink factor of 1.6)
# Push Increase/Decrease Width button
# Push Increase/Decrease Height button
Note: it is best to scale in one step vs multiple steps as control widths and font sizes are integers and may have rounding after each step.
Note: any bitmap images will be unchanged and remain the same size. They can be manually scaled with a graphics app if necessary.
Screen Editor with Screen Scale of 60% and all controls selected:
[[File:ScreenScale.png|none|link=|710x627px]]
Example Original Screen:
[[File:ScreenScale100.png|none|link=|639x471px]]
Example Scaled up 60%
[[File:ScreenScale160.png|none|link=|879x641px]]
=====Hierarchical Sub Script Files=====
When creating multiple Screens with sections of Controls that are duplicated among screens, possibly re-positioned on the Screen, it is useful to make use of SubScript files. Selecting one or more Controls and setting a SubScript file name for them will move them to a separate file which will then be referenced from the main file. SubScript files can also reference SubScript files in a hierarchical manner.
See this Video Demonstration
{{#ev:youtube|bWToNV6922s}}