Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomEditButton.Visible Property

Specifies if the editor button is visible.

#Declaration

Delphi
property Visible: Boolean read; write; default True;

#Property Value

Type Default Description
Boolean True

True if the editor button is visible; otherwise, False.

#Remarks

Set the Visible property to False or True to hide or display the button.

#Code Example: Display a Different Button in Read-Only Mode

The code example in this topic section demonstrates an OnPropertiesChanged event handler for a TcxImageComboBox editor.

This event handler changes editor appearance and behavior in response to ReadOnly property value changes as follows:

Read-Only Mode

Hides the predefined drop-down button and displays the custom Info button at the left editor border when the ReadOnly property value changes to True.

VCL Editors Library: A Custom Image Combo Box Example in Read-Only Mode

Normal Mode

Restores the initial editor layout and behavior when the ReadOnly property value changes back to False.

VCL Editors Library: Normal Image Combo Box Appearance and Behavior

procedure TMyForm.cxImageComboBox1PropertiesChanged(Sender: TObject);
var
  AProperties: TcxImageComboBoxProperties;
  AButton: TcxEditButton;
begin
  AProperties := (Sender as TcxImageComboBoxProperties);
  if AProperties.ReadOnly then  // Configures the read-only editor layout
  begin
    AProperties.BeginUpdate;  // Initiates the following batch change
    try
      AProperties.Buttons.Items[0].Visible := False;  // Hides the predefined drop-down button
      if AProperties.Buttons.Count = 1 then
      begin
        AButton := AProperties.Buttons.Add;
        AButton.Kind := bkText;
        AButton.Caption := 'Info';
        AButton.LeftAlignment := True;
      end;
      AProperties.Buttons.Items[1].Visible := True;  // Displays the "Info" button
      AProperties.Buttons.Items[1].Default := True;
    finally
      AProperties.EndUpdate;  // Calls EndUpdate regardless of the batch operation's success
    end;
  end
  else if not AProperties.ReadOnly then  // Restores the initial editor layout
  begin
    AProperties.BeginUpdate;  // Initiates the following batch change
    try
      AProperties.Buttons.Items[0].Visible := True;  // Displays the predefined button
      AProperties.Buttons.Items[0].Default := True;
      if AProperties.Buttons.Count = 2 then
        AProperties.Buttons.Items[1].Visible := False; // Hides the "Info" button
    finally
      AProperties.EndUpdate;  // Calls EndUpdate regardless of the batch operation's success
    end;
  end;
end;

#Default Value

The Visible property’s default value is True.

See Also