Recent

Author Topic: [SOLVED] Suppressing default actions of TButtonPanel  (Read 206 times)

egsuh

  • Hero Member
  • *****
  • Posts: 950
[SOLVED] Suppressing default actions of TButtonPanel
« on: July 04, 2022, 09:28:21 am »
I'd like to use TButtonPanel, but not using the default actions of Close, OK, and Cancel. Instead, I'd like to change the actions through OnClick event handler. How can I do it?
« Last Edit: July 04, 2022, 11:37:38 am by egsuh »

wp

  • Hero Member
  • *****
  • Posts: 9921
Re: Suppressing default actions of TButtonPanel
« Reply #1 on: July 04, 2022, 10:23:57 am »
After selecting the ButtonPanel, go to page Events of the Object Inspector. Here you see, in gray, the individual buttons. Open these nodes (by clicking at the symbol in the left column), and you have access to the OnClick events. Likewise, on the Properties page, you can get access to the individual properties of these buttons so that you can change captions or icons.

egsuh

  • Hero Member
  • *****
  • Posts: 950
Re: Suppressing default actions of TButtonPanel
« Reply #2 on: July 04, 2022, 10:56:31 am »
Quote
After selecting the ButtonPanel, go to page Events of the Object Inspector. Here you see, in gray, the individual buttons. Open these nodes (by clicking at the symbol in the left column), and you have access to the OnClick events.

I did. I wrote OnClick event of Close button, but when I press the button, the form simply closes.

wp

  • Hero Member
  • *****
  • Posts: 9921
Re: Suppressing default actions of TButtonPanel
« Reply #3 on: July 04, 2022, 11:04:39 am »
Not accessible at designtime, but you could change the Kind of the CloseButton in the OnCreate event of the form:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   ButtonPanel1.CloseButton.Kind := bkCustom;  // requires unit "Buttons" in the uses clause
  4. end;

egsuh

  • Hero Member
  • *****
  • Posts: 950
Re: Suppressing default actions of TButtonPanel
« Reply #4 on: July 04, 2022, 11:37:23 am »
Quote
ButtonPanel1.CloseButton.Kind := bkCustom;  // requires unit "Buttons" in the uses clause


I see. Now it works as I intend. Thank you for your help.

 

TinyPortal © 2005-2018