Jump to content

How to set UniSpinEdit.Value to UniSpinEdit.MaxValue when the numbers typed greater than UniSpinEdit.MaxValue


Recommended Posts

Posted

Hello,


UniSpinEdit.MaxValue works only when you click the up & down buttons, but does not work when you type the numbers directly.

And doing something like

  if UniSpinEdit1.Value > UniSpinEdit1.MaxValue then
    UniSpinEdit1.Value := UniSpinEdit1.MaxValue;

do not work in these events: OnChange, OnChangeValue, OnExit, OnKeyPress.

Does anyone have a solution?

Thanks

Posted

Hello,

2 hours ago, jrp said:

UniSpinEdit.MaxValue works only when you click the up & down buttons, but does not work when you type the numbers directly.

Try this approach:

UniSpinEdit.ClientEvents.ExtEvents ->

function render(sender, eOpts)
{
    sender.on('change', function() {
        var max = sender.maxValue || 100;
        var val = parseInt(sender.getValue(), 10);

        if (val > max) {
            sender.setValue(max);
        }
    });
}

 

  • Thanks 1
  • 1 month later...
Posted

it works:

function render(sender, eOpts)
{
   sender.on('change', function() {
        var max = sender.maxValue || 31;
        var min = sender.minValue || 1;
        var val = parseInt(sender.getValue(), 10);

        if (val > max) {
            sender.setValue(max);}
        
        if (val < min) {
            sender.setValue(min);}
    });
}

  • 2 weeks later...
Posted
On 9/24/2025 at 6:41 PM, SISBLU Software said:

It worked correctly, but if allowed, it leaves the field blank. How can I prevent it?

Hello,

If you haven’t solved the issue yet, could you please explain it again in more detail or provide a simple test case?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...