Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter NineDialog Functions (continued)

9.17 Data Controls

9.17.1 Introduction

The Data Control window is a custom control that supports many data style views within the application and can also be used as general dialog control. The class, “data_control”, operates with a subset of “listbox” class functionality with spreadsheet capabilities. The alias “DataClass” may also be used as the class name.

This section covers the operation, styles and functions for the Data Control window.

9.17.2 List Box Emulation

When first created by a dialog, the Data Control operates in LBS_STANDARD mode. It does need the WS_BORDER style since by the control does not draw a border.

Functionality of a Data Control can be expanded by a combination of LBS_ styles and functions (messages).

List boxes are row-height based on the font. Data Controls have a fixed row height that can be adjusted on the fly and the window size if not related to the height, and as such, the window can contain a fractional number of lines.

9.17.3 Data Control Types and Styles

Styles follow the LBS_ styles. 

9.17.4 Data Control Notifications

All list box notifications are processed through the “action” procedure. The Control Action value (2nd parameter) will contain the notification or action code. Note that certain of these messages are only sent to the script if LBS_NOTIFY is set within the control’s style.

  Notification code   Value   Description  
  List Box Analogues          
    DCN_ERROR_SPACE   -2   Error in Space (LBN_ERRSPACE)  
    DCN_SELECT_CHANGE   1   Select Change (LBN_SELCHANGE)  
    DCN_DOUBLE_CLICK   2   Double Click on Item (LBN_DBLCLK)  
    DCN_SELECT_CANCEL   3   Select Cancel (LBN_SELCANCEL)  
    DCN_SET_FOCUS   4   Set Focus (LBN_SETFOCUS)  
    DCN_KILL_FOCUS   5   Kill Focus (LBN_KILLFOCUS)  
  Data Control Specific:          
    DCN_BUTTON_CLICK   10   Clicked on a Button Type. Button Click will be sent if the Control Click () message is not processed.  
    DCN_COL_LEGEND_CHANGE   24   Column Drag/Legend Change Was Made  
    DCN_COMBO_DROP   23   User Clicked Combo Drop (for a cell)  
    DCN_CONTEXT_MENU_KEY   12   The context menu key was pressed.  
    DCN_CONTROL_CLICK   13   Click on Control Type — Button Click will follow if the Control Click message is not processed and the control type is button type. Get the caret position to locate the control, not the select position.  
    DCN_DOUBLE_CLICK_SELECT   11   Sent on a double-click during selection of a cell or row.  
    DCN_EDIT_CHANGE   8   Non-Caller/User edit cell change was made. Note that is a cell is activated for editing and the user does not change the text (as compared to the original), the edit sequence is terminated.  
    DCN_EDIT_CHANGING   9   Non-Caller/User Edit About to Change. This message is sent prior to changing the cell content. Setting an error code in the last action using DataControlSetActionReturnCode will stop the cell from updating.  
    DCN_EDIT_CONTROL_ACTIVATE   14   Request Edit Control activate for on sheet editing. The operation can be cancelled by setting a non-zero action return code using the DataControlSetActionReturnCode function.  
    DCN_GET_EDIT_CONTROL_SIZE   16   Request Size of Edit Control. This action allows the script to set an advisory limit on the size of the data the user can type into the edit control. It does not limit the actual characters. Size is set by using the DataControlSetActionReturnCode function.  
    DCN_ICON_CLICK   7   Clicked on Icon (down button)  
    DCN_POPUP_MENU_CELL   17   Menu for Popup About to Display  
    DCN_POPUP_MENU_COLUMN   18   Menu for Popup About to Display  
    DCN_POPUP_MENU_CORNER   19   Menu for Popup About to Display  
    DCN_POPUP_MENU_ROW   20   Menu for Popup About to Display  
    DCN_RIGHT_CLICK   6   Right Click (on button up)  
    DCN_ROW_LEGEND_CHANGE   25   Row Drag/Legend Change Was Made  
    DCN_SIZE_CHANGE   22   Non-Caller Size Change Was Made  
    DCN_SORT_CHANGE   26   Column Heading Click Caused a Sort Change  
    DCN_TAB_OUT   21   Tab Passed Edge  
    DCN_VK_NOTIFY   30   Virtual Key Notify (key down). Use the GetMessageParameter function to retrieve the lParam for key information.  
    DCN_MENU_FUNCTION_BASE   99   Any Message above this are menu function IDs. This only applies for dialog style controls. Notification is only set if DCC_POPUP_NOTIFY is set for a menu.  

Avoid using raw values, rather, use the DCN_ definitions.

9.17.5 Data Control Functions

Adding Data:

DataControlAddString — Adds a string as a new row, source can be CSV or tab delimited.

DataControlLoadList — Loads a list of items to a list box.

DataControlSetCellType — Sets the display type for the cell, row, column and type.

Cell Processing:

DataControlFindCell — Finds all or part of the data within a Data Control.

DataControlGetCaretPosition — Returns current caret position.

DataControlGetCellRect — Returns the position, height and width of a cell in pixels.

DataControlGetCellSize — Returns the size of the display content of a specified cell in bytes.

DataControlGetCellText — Gets the cell’s display text by row and column.

DataControlGetCellType — Gets the cell’s display type.

DataControlGetClickData — Returns the last click information from the control.

DataControlGetClickPosition — Returns the last position within the control to receive a mouse click.

DataControlMergeCells — Merges one or more table cells on a row.

DataControlSetCaretPosition — Sets the position of the caret for a cell-addressable control.

DataControlSetCellState — Sets the display state for a specified cell by row and column.

DataControlSetCellStyle — Sets a simple style for a specified cell by row and column.

DataControlSetCellText — Sets the text/data value for a specified cell by row and column.

Combo Box Processing:

DataControlComboAddString — Adds a string to a combo box cell.

DataControlComboAddList — Inserts a list of items at an optional specified position.

DataControlComboDeleteItem — Deletes a list item from a specified index.

DataControlComboFindString — Finds a string within a combo list.

DataControlComboGetItemCount — Returns the total items in the list box portion of the combo.

DataControlComboGetSelectIndex — Returns the index position of the selected item.

DataControlComboGetString — Gets a string at the specified index position.

DataControlComboInsertString — Inserts to a string to a combo box cell.

DataControlComboReset — Resets the content of the combo box.

DataControlComboSelectItem — Selects a string in the list or an item by index.

Content/Sheet Management:

DataControlGetColumnCount — Gets the number of columns.

DataControlGetRowCount — Gets the number of rows.

DataControlRefreshLegends — Refreshes both column and row legends.

DataControlResetContent — Resets the content of the Data Control. Optionally resets the associated legends.

DataControlSetCellHighlight — Sets a highlight color for specified cell by row and column.

DataControlSetGridMode — Sets a data control grid display mode.

DataControlSetHighlightMode — Sets the highlight mode.

DataControlSetSelectColor — Sets the select color theme for the control.

DataControlSetSelectMode — Sets the select mode such as cell, rows, columns.

Column Processing

DataControlDeleteColumn — Deletes a specified column or columns.

DataControlSetColumnHeadings — Sets headings for a data control from a string array or series of strings.

DataControlInsertColumn — Inserts one or more columns into the Data Control sheet.

DataControlSetColumnHeadings — Sets headings for a data control from a string array or series of strings.

DataControlSetColumnPositions — Sets column positions for a data control an integer array or from a series of integers.

Control:

ControlDisable — Disables specified control.

ControlEnable — Enables specified control.

ControlHide — Hides a specified control.

ControlShow — Shows a specified control (if hidden).

On Sheet Editing:

DataControlGetChangingText — Retrieves the text entered by a user into a cell via on sheet editing.

DataControlSetActionReturnCode — Sets the return value for action messages that return additional data.

DataControlSetLocalEditMode — Sets or enables the local cell edit mode.

DataControlSetStatusWindow — Sets a companion status window.

Retrieving Data:

DataControlGetCellText — Gets the cell’s display text by row and column.

DataControlGetString — Returns the content of a row.

DataControlGetTable — Retrieves the entire data control set as a string table.

Row Processing:

DataControlDeleteRow — Deletes a specified row.

DataControlFindRowData — Finds matching row data word from an optional starting position.

DataControlGetRowData — Gets row data word for specified row.

DataControlInsertRow — Inserts one or more rows into the Data Control sheet.

DataControlSetRowColor — Sets the text color of a specified row.

DataControlSetRowData — Sets the row data word for a specified row.

DataControlSetDefaultRowHeight — Sets the default row height in pixels.

DataControlSwapRows — Swaps the contents of two rows.

Single Select:

DataControlGetRowSelection — Gets the selected position in a single select data control.

DataControlSetRowSelection — Selects the specified row within the control.

Sorting:

DataControlGetSortColumn — Returns the column index being used to sort the control's data.

DataControlGetSortMode — Returns the mode being used to sort the control's data.

DataControlSetSortColumn — Sets the sort to a specific column and more. Optionally resets sort.

Page revised 2024-12-13