Recent

Author Topic: How to handle Buttons on TUpDown component ?  (Read 635 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: 2989
  • 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

  • Full Member
  • ***
  • Posts: 189
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.
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit

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.