%U_SELPALETTE

Select a color palette entry

WTSupported in traditional Synergy on Windows

 

 

 

user_selection = %U_SELPALETTE(initial_selection)

user_selection

On Windows, the number of the palette entry chosen by the user, or false if canceled. On UNIX and OpenVMS, always returns false. (^VAL)

initial_selection

The number (in the range 1-16) of the palette entry you want selected when the window opens. If the value passed is invalid, an error message is displayed and the function immediately returns 0. (n)

A call to %U_SELPALETTE opens a selection window from your application that enables users to select a Synergy color combination. Typically this is used to customize user preferences. See figure 1.

1. Palette selection window.

Palette selection window

Each numbered square in the palette window corresponds to a color palette entry in the Synergy runtime and displays the foreground and background color for the entry. (The color of the number is the foreground color. The color of the box is the background color.) The current palette settings determine the initial colors, and the initial_palette argument specifies the initial selection. A thin-line box surrounds the selected entry. In figure 1, for example, entry 1 is selected.

The user selects the entry and clicks OK or presses Enter. %U_SELPALETTE then returns the number for the selected entry.

%U_SELPALETTE returns 0 if the Cancel button is clicked, if the close button in the caption bar is clicked, or if esc is pressed while the selection window is active.

In the following example, the variable color refers to the color of a background window (whose ID is backwnd) placed within the application window. This section of code enables the user to select a new color and apply it.

.align
stack record
    color      ,i4
    newcolor   ,i4
    retvals    ,6d4
    backwnd    ,i4
proc
    xcall w_info(WI_ATTRS, backwnd, retvals) ;Get current window color
    color = retvals(2)                            ;Window color palette
    if ((newcolor = %u_selpalette(color) .and.
    &   (newcolor .ne. color))                    ;New color selected?
     begin
       color = newcolor                           ;Apply the change
       xcall w_area(backwnd, WA_COPY, WAC_WTOP,
       &                       WA_COLOR, color)   ;Change the window area
       xcall w_disp(backwnd, WD_COLOR, color)     ; and the current
                                                  ; display color.
     end