TUpDown increase button starts decreasing after value reaches 100 lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- CM630 · 2025-08-06 08:17 I have not seen it myself, but while investigating a bug report there ocurred to be a problem with the TUpDown control in MacOs. Here is the snippet: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)    Label1: TLabel;    UpDown1: TUpDown;    procedure FormCreate(Sender: TObject);    procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);  private   public   end; var  Form1: TForm1;  Indication : integer = 0; implementation {$R *.lfm} { TForm1 } procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);begin   if (Button = btNext)    then inc(Indication,1)    else dec(Indication,1);  Label1.Caption := IntToStr(Indication);end; procedure TForm1.FormCreate(Sender: TObject);begin    Label1.Caption := IntToStr(Indication);end; end. When the Up button is held, initially Indication increases. But after it reaches (or exceeds) 100, it starts decreasing. The issue is not observed on Windows and Linux (Mint Mate). It was reported on MacOs El Capitan, but AFAIU it was observed also on another MacOS version, I will add this info when available. The executable was built with Lazarus 4.2. ---------------------------------------------------------------------- wp · 2025-08-06 10:05 Yes, I confirm this. It seems as if the upper buttons mysteriously changes to btPrev when the upper limit is reached (this does not happen with the lower button correspondingly, and when the initial Indicator value is > 0 the direction change happens later). But when I display the value of the UpDown's Position property everything is correct (like in Windows), and when the Wrap property is active and a limit is reached the Position jumps to the other end and continues running, as expected. ---------------------------------------------------------------------- CM630 · 2025-08-06 10:47 So if I get you right: 1. I shall create bug report for that (I sought the bugtracker and did not find it described). 2. UpDown1.Wrap := True; can be used as a workaround in this case, because the position is not used? I was thinking about Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);begin  UpDown1.Position := 0;  ... end;but if wrap = True is fine, then it is fine. (I do not have a modern Mac, so I cannot try these myself) ---------------------------------------------------------------------- wp · 2025-08-06 11:22 I wonder why you introduce your own counting variable "Indication", rather than using the UpDown.Position which is just there for this exact purpose. And it is working correctly (at least on my VirtualBox on Windows with mac OS X 10.14 VM). ---------------------------------------------------------------------- CM630 · 2025-08-06 11:32 In this particular case, TUpDown is a part of a custom control, the .Position property is not used. What is used is Up and Down, received as Button: TUDBtnType in OnUpDown1Click. Reported as https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41792 ---------------------------------------------------------------------- Bart · 2025-08-06 20:25 If TSpinEditEx works correct on Mac OS X, then you can take a look at how I implemented it ("communciation" between edit and updown) there? Bart ---------------------------------------------------------------------- CM630 · 2025-08-08 06:37 Quote from: Bart on August 06, 2025, 10:25:45 pmIf TSpinEditEx works correct on Mac OS X, then you can take a look at how I implemented it ("communciation" between edit and updown) there? Bart I am not sure that I understood you, do you mean that I could find a workaround in the code of TSpinEditEx? I was told that UpDown.Wrap := True worked in our case, but that does not make the bug in TUpDown non-existent. Quote from: wp on August 06, 2025, 01:22:28 pm...And it is working correctly (at least on my VirtualBox on Windows with mac OS X 10.14 VM)... I was wondering if MacOS is installable on VirtualBox and how legal it is. I should try to install it. I have a PPC Mac, I doubt that I could test anything on it. ---------------------------------------------------------------------- Bart · 2025-08-08 07:24 Quote from: CM630 on August 08, 2025, 08:37:57 amI am not sure that I understood you, do you mean that I could find a workaround in the code of TSpinEditEx? I was told that UpDown.Wrap := True worked in our case, but that does not make the bug in TUpDown non-existent. I was suggesting to look a TSppinEditEx to see wether I implemented it defferently than you did. If so, and if TSpinEditEx does not have this buggy behaviour, then you could possibly have a workaround. I did not imply that the bug was not there, just offered a suggestion to get around it. Bart ---------------------------------------------------------------------- CM630 · 2025-08-08 08:46 There is already a working workaround (I was told), but maybe TSpinEditEx will also misbehave in MacOS. In spinex.inc there is Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TSpinEditExBase.UpDownClick(Sender: TObject; {%H-}Button: TUDBtnType);begin  BuddyClick;end;   {%H-} seems to be sth. for Delphi compatibility, and Button does not seem to be used, so maybe everything will be fine. ---------------------------------------------------------------------- Bart · 2025-08-08 13:40 IIRC this just calls the OnClick handler. The internal logic (increment/decrement) is somewhere else I think. But you can just test TSpinEditEx with a Max > 100 and see what happens? I have no access to a Mac, so I can't. Bart