setCtlBuddyStyle

Syntax

int setCtlBuddyStyle(int n, int buddy, int flags)

Arguments

n
The number of the STANDARD or SLIDER control to modify
buddy
Set to 1 to modify the edit box, or to 0 to modify the text label
flags
The style flags to assign to this control.

Style Flags

ES_CENTER Centers the text in the edit box when editing
ES_LEFT Left-aligns the text in the edit box when editing
ES_LOWERCASE Forces all letters to be lowercase in the editbox
ES_NUMBER Only allow numbers to be typed into the editbox
ES_RIGHT Right-aligns the text in the edit box when editing
ES_UPPERCASE Forces all letters to be uppercase in the editbox
SS_BLACKFRAME Adds a black rectangle around the text label
SS_BLACKRECT Replaces the label with a blackbox
SS_ETCHEDFRAME Adds an etched frame to the text label
SS_ETCHEDHORZ Adds an etched frame to the text label
SS_GRAYFRAME Adds a gray rectangle around the text label
SS_GRAYRECT Replaces the label with a gray box
SS_WHITEFRAME Adds a white rectangle around the text label
SS_WHITERECT Replaces the label with a white box
WS_BORDER Enables the single border outline of the editbox

Return

Returns false is control number n is out of range or unused. Otherwise, returns the result of the internal SetWindowPos function (true if succeeded, false otherwise).

Description

Changes the window style of the labels and edit boxes of a STANDARD or SLIDER control.

Comment

This functions must be followed by refreshCtl or refreshWindow, or the changes may not take effect.

Due to a bug, refreshCtl and refreshWindow may effect the text label rendering differently.

Note that you cannot remove window styles with this function. To remove a style, use clearCtlBuddyStyle.

Example

%ffp

ctl(0): PUSHBUTTON, "Make Changes", Size=(60, *)
ctl(1): PUSHBUTTON, "Clear Changes", Size=(60, *), Pos=(*,20)
ctl[4]: STANDARD, "Example"

OnCtl(n):{

  if (n==0 && e==FME_CLICKED) {

    // Make editbox Uppercase & Right-aligned
    setCtlBuddyStyle(4, 1, WS_BORDER | ES_UPPERCASE | ES_RIGHT);
    setCtlBuddyStyle(4, 2, SS_GRAYFRAME);
    refreshWindow();
  }

  if (n==1 && e==FME_CLICKED) {

    // Clear previously set styles
    clearCtlBuddyStyle(4, 1, WS_BORDER | ES_UPPERCASE | ES_RIGHT);
    clearCtlBuddyStyle(4, 2, SS_GRAYFRAME);
    refreshWindow();
  }

  return false;
}

See Also

clearCtlBuddyStyle, (clearCtlBuddyStyleEx)?, refreshCtl, (setCtlBuddyStyleEx)?, STANDARD, SLIDER