Skip to main content

TcxCustomFontNameComboBoxProperties.OnAddedMRUFont Event

Occurs after adding a font to the MRUFontNames collection.

Declaration

property OnAddedMRUFont: TNotifyEvent read; write;

Remarks

The OnAddedMRUFont event is fired when a font is added to the MRUFontNames collection. Handle this event if you wish, for instance, to synchronize the MRU lists of two combo boxes (see the example below). This event does not occur if the selected font name is already added to the MRU list.

Use the AddMRUFontName and DelMRUFontName methods to manage the MRU font list programmatically.

The following code handles the OnAddedMRUFont event in order to synchronize the MRU lists of two font name combo boxes:

procedure TForm1.cxFontNameComboBox1PropertiesAddedMRUFont(Sender: TObject);
var
  FontNameComboBoxProperties: TcxFontNameComboBoxProperties;
begin
//obtaining the Properties object, containing the MRUFontNames collection
  FontNameComboBoxProperties := Sender as TcxFontNameComboBoxProperties;
//adding the first item from the MRU list of the major font name combo box
//to the MRU list of the dependant font name combo box
    cxFontNameComboBox2.AddMRUFontName(FontNameComboBoxProperties.MRUFontNames[0].FontName);
end;

After a specific font name is selected within the major font name combo box (the leftmost combo box), that font name appears within the MRU list of the rightmost combo box:

Also the selected font name appears within the MRU list of the dependant font name combo box:

See Also