-1

I associated a TEdit to a TUpDown. It updates the TEdit text fine automatically with the TUpDown.position value. But I want to display custom captions depending on the TUpDown.position value. For this I unassociated the TEdit from the TUpDown and wrote custom onClick/onChanging handlers. But both of the cases the TUpDown.position contains the previous value (not the incremented/decremented one). What event should I use to update the TEdit.text depending on the right TUpDown.position value?

I use Delphi XE4.

User007
  • 187
  • 10

1 Answers1

4

Use the OnChangingEx event. It has a NewValue parameter, that holds the new value to which the control is changing.

procedure TForm19.UpDown1ChangingEx(Sender: TObject; var AllowChange: Boolean;
  NewValue: Integer; Direction: TUpDownDirection);
begin
  Edit2.Text := IntToStr(NewValue);
end;
Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
  • Yes there it is. I thought it is a depricated onChanging event handler. The Ex postfix used to be mark this state. :( But it works fine now. Thanks a lot. – User007 Aug 11 '17 at 16:22
  • 4
    @User007: Um, no. The Ex postfix means it's a **newer**, extended version of the event, not deprecated. See `ShellExecute` and `ShellExecuteEx` in the WinAPI, for instance. – Ken White Aug 11 '17 at 16:24