%U_SELPALETTE
WSupported on Windows
|
|
|
|
user_selection = %U_SELPALETTE(initial_selection)
Return value
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)
Arguments
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)
Discussion
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.
|
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.
See also
- U_REND routine
- The WP_PALET function for W_PROC
- The WA_COLOR function for W_AREA
- Colors and the color palette
Examples
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