Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FifteenWindows/OS Functions (continued)

ClipboardAttachDialog Function

Overview

The ClipboardAttachDialog function attaches the current dialog page to the clipboard notification chain.

Syntax/Parameters

Syntax

int = ClipboardAttachDialog ( [boolean release] );

Parameters

release

An optional boolean value, when set to TRUE results in the dialog page being removed from the clipboard chain. The default is FALSE.

Return Value

Returns an int as ERROR_NONE for a formatted error code on failure.

Remarks

Windows maintains a clipboard chain which is a series of windows that receive a simple notification any time the content of the clipboard changes. The ClipboardAttachDialog allows the current dialog to be added or removed from the chain. When added, the procedure named with the suffix _clipboard_changed is called each time the clipboard is updated.

When the dialog page is closed, it will automatically be removed from the clipboard chain. An example program to monitor the clipboard:

int main() {
    DialogBox("Clip01Flag", "cbm_");
    return 0;
    }
    
int cbm_load() {

    ListBoxSetTabPositions(102, 80);
    ClipboardAttachDialog();
    return 0;
    }
    
int cbm_clipboard_change() {
    string              s1, s2;
    string              list[50];
    handle              hCB;
    int                 ix, size;
    
    s1 = ClipboardGetApplication();
    EditSetText(101, s1);

    ListBoxReset(102);
    list = ClipboardGetFormats();
    size = ArrayGetAxisDepth(list);

    while (ix < size) {
      s1 = ArrayGetKeyName(list, ix) + "\t" + list[ix];
      ListBoxAddItem(102, s1);
      ix++;
      }
    return 0;
    }
    
#beginresource
Clip01Flag DIALOGEX 0, 0, 240, 102
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_CONTEXTHELP
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test/Watch Clipboard"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 101, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, \
                   6, 6, 220, 60, 0
 CONTROL "", 102, "listbox", LBS_STANDARD | LBS_USETABSTOPS  | WS_CHILD | WS_VISIBLE, \
                   6, 20, 220, 80, 0
}

#endresource

While scripts should avoid changing clipboard content while responding to a clipboard change, the procedure will not allow reentry until the initial change message is processed.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic