Custom Control Panels

Custom Control Panels differ from custom Dialog boxes, in that Dialog boxes are called from a SmartCAM macro. While Control Panels are not called from a macro, rather they call a macro. Additionally, like standard SmartCAM panels, the location and size of the panel is fixed; although there is some control over the height of the panel.

Custom panels must be integrated into the SmartCAM menu system and/or existing task sets to be available. This is a simple process handled with two simple changes to your application's INI file.

A simple example of how to use Custom Panels will be to extend the Path Length macro developed earlier in this tutorial series. This macro uses a hard-coded path and filename for the output report file, this tutorial will modify this to use a control panel with a File Input UI component. This panel will then launch the macro.

As in previous exercises, all files are assumed to exist in a C:\MACROS subfolder.

Add UI to PATHLEN.MCL

The current macro has the path hard coded, when called from a Custom Panel, the path will be passed to the macro from the control panel. Therefore, the hard-coded path is no longer required.

Modify the Macro

Modify the PATHLEN.MCL macro and comment out the declaration of the #OUTFILE variable.

// User variables
// STRING:#OUTFILE="C:\\TEMP\\PATHLEN.TXT"

If the PATHLEN.MCL macro file does not already exist, open the "Coding the Macro" topic and use Copy and Paste to copy the macro contents into a new ASCII text file. Save the file with the name PATHLEN.MCL. Then make the above change.

Create the Panel

Launch Visual CTK and then create a new Panel PCB file. This can be done by selecting the appropriate icon on the toolbar or by using File - New and selecting Panels on the New CTK File dialog.

When the Resources dialog box is opened, select New. The Panel Properties box is displayed. Enter the following:

Press OK to display the custom panel and add UI components.

This panel needs two UI components: a FILE input line, for entering the output file path and a File Select button to open the File Select dialog.

Click on the panel representation (it has the title text "Path Length"). The Token Palette will be displayed.

Add the File Input

Select the FILE icon from the Token Palette.

Click on the panel representation and set the initial location for the FILE token. A Token Properties box is displayed. In the Label: field enter: Report File:. In the Variable: field enter the variable name. This is the variable that will pass the user selected report path and filename to the macro. Use the same name as the equivalent variable in the macro itself: OUTFILE. The Field Width is the display length of the UI token, not the length of the path. Enter 35 for the width. Then press OK.

The File input is displayed on the dialog box.

Notice the variable name does not include the # suffix. Visual CTK does not need the # character, it will be added when the variable is passed to the macro system.

Add the File Section button

Select the FILESELECT icon from the Token Palette.

Click on the panel representation to set the initial location for the action button. There is no Token Properties dialog associated with this component. It will use the active FILE token when triggered.

Positioning

Use the Pointer icon, the first icon on the left, and click and drag the UI components on the dialog to look like:

Resize the Panel

Since all the UI components can fit on a single line, the panel height can be reduced from 3 lines to 2.

Save the PCB file

Use File - Save As and save the file as PATHLEN.PCB. For purposes of the tutorial, create a C:\MACROS path and save the file there.

Integrate Panel into SmartCAM

This step adds the custom panel to the SmartCAM main menu. There are several locations where the custom Panel may be placed, however, for this exercise they will be added to a User menu.

Start your SmartCAM application and open Utility - Options. Change to the User Menu Options category.

Use the User Menu Name category option to set the User menu name for the customizations. This name will be the name added to the SmartCAM main menu bar.

Edit Menu Item 1 Name to configure the name of the menu item. This appears under the User (or User Menu Name configured) menu, on the main menu. Selecting this name launches your automation.

The Menu Item 1 PCB is the fully qualified path to the .PCB file containing your custom panel.

Complete the following steps:

If Menu Item 1 Name and Menu Item 1 PCB are already in use, then find the next available set of menu items to use. Start with Menu Item 2 Name/PCB.

Test the Panel

Start your SmartCAM application. Notice, that if it was not there before, there is now a User menu entry on the Main Menu. Open this and you will find the Path Len entry.

Select Path Len from the User menu. Notice Path Len is now added to the taskbar and the single Tool List item, named Path Length, is displayed in the User task pull-right. The custom panel is displayed and active.

Type in the path and filename for the report file. The File Select button opens the Windows File Open dialog, so it can be used when you wish to reuse an existing file, but it cannot be used to create a new file.

Once the fully qualified path and filename is entered, press the Go button. The pathlen.mcl macro will run and the output will be created in the specified path.

The custom panel and macro are now integrated with SmartCAM.

Related Topics

Integration with SmartCAM User Interface

Dialog Boxes

Creating a User Interface Overview

SmartCAM Automation Overview