Path Control
- Updated2023-02-21
- 3 minute(s) read
toolslib\custctrl\pathctrl.fp
This instrument driver contains functions for creating and modifying a path control.
To create a path control programmatically, call the NewPathCtrl function to convert a string control into a path control. You also can add a path control to your user interface by selecting Create»Custom Controls»Toolslib Controls»Path Control.
You can use a path control to enter file and directory paths. As you type in the path control, the control displays matching files and directories in a drop-down list box. You can set the ATTR_PATH_CTRL_FILE_FILTER and ATTR_PATH_CTRL_FILE_SPECIFICATION attributes to customize the types of files that display in the list box. For example, the following function call specifies that only directories can appear:
SetPathCtrlAttribute (panelHandle, PANEL_STRING, ATTR_PATH_CTRL_FILE_SPECIFICATION, kPathCtrlDirectoryFile);
![]() |
Note The path control does not recognize network share names. For example, when you type \\remoteComputer\, the path control does not display any matches because it does not recognize the network shares in \\remoteComputer\. However, when you type \\remoteComputer\remoteShare\, the path control displays the files and directories in \\remoteComputer\remoteShare\. |
Item Selection
To navigate the items in the path control drop-down list box, use the up arrow and down arrow keys. You also can use the <Shift> and <Tab> keys to navigate the items if you enable the ATTR_PATH_CTRL_TAB_COMPLETES_PATH attribute. Select an item from the drop-down list box by navigating to it and pressing <Enter> or by clicking on the item. You can click on an item only if the path control is on a non–modal panel. The current item in the drop-down list box also is selected when you click outside the file list. You can press the right arrow key to complete the path in the path control; on completion, the path control's value is set to the first matching item from the list. The path control drop-down list box is dismissed when you select an item. You can dismiss the file list without selecting an item by pressing <Esc>.
Path Control History
The path control keeps a history of the paths that you have selected in the control. To access the items in the history, press the up arrow or down arrow keys when the list box is not visible. You also can display selected items in the list box by enabling the ATTR_PATH_CTRL_SHOW_HISTORIC_FILES attribute.
Event Handling
Due to interactions between the path control list box and your string control, many events occurring on your string control are not sent to your callback function. Do not rely on getting events in your callback function but instead programmatically get the value in the control when required. In most cases, your callback function receives an EVENT_VAL_CHANGED event when the value of the path control changes. Your callback function receives an EVENT_COMMIT event when a new value is committed in the path control. This can occur when you dismiss the path control list box by selecting a path or when you type a new path and press <Enter>. You might not get EVENT_COMMIT events in many other situations handled by a normal string control.
