Recent

Author Topic: How to handle Buttons on TUpDown component ?  (Read 2348 times)

DenPit5

  • New Member
  • *
  • Posts: 21
How to handle Buttons on TUpDown component ?
« on: February 13, 2019, 05:26:00 pm »
Can anyone explain How to distinguish which of the two buttuns on the TUpDown control was pressed. ?

Handoko

  • Hero Member
  • *****
  • Posts: 5132
  • My goal: build my own game engine using Lazarus
Re: How to handle Buttons on TUpDown component ?
« Reply #1 on: February 13, 2019, 05:29:57 pm »
Something like this below?

Code: Pascal  [Select][+][-]
  1. procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
  2. begin
  3.   case Button of
  4.     btNext: ShowMessage('Up is pressed');
  5.     btPrev: ShowMessage('Down is pressed');
  6.   end;
  7. end;

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: How to handle Buttons on TUpDown component ?
« Reply #2 on: February 13, 2019, 05:31:26 pm »
Can anyone explain How to distinguish which of the two buttuns on the TUpDown control was pressed. ?

OnClick gets a TUDBtnType parameter: btPrev, btNext.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

DenPit5

  • New Member
  • *
  • Posts: 21
Re: How to handle Buttons on TUpDown component ?
« Reply #3 on: February 13, 2019, 09:17:24 pm »
Many thanks HanDoko and dsiders for replies. That is just what I required.   Thanks again.

 

TinyPortal © 2005-2018