Jump to content

Recommended Posts

Posted

Hi!

I have a TUniSpinEdit control on form. It is used to choose a year. So, first of all, I need this control to allow integer values only (without floating part).

And I need to set the value increment to 1. Because while I press and hold an arrow of my control, the value increasing/decreasing continiously.

Thank's in advance for help!

 

Posted

Hi,

52 minutes ago, Nadya said:

I have a TUniSpinEdit control on form. It is used to choose a year. So, first of all, I need this control to allow integer values only (without floating part).

UniSpinEdit.ClientEvents.UniEvents ->

function beforeInit(sender, config)
{
    config.allowDecimals=false;
    config.allowExponential=false;
}

UniSpinEdit.ClientEvents.ExtEvents ->

function keydown(sender, e, eOpts)
{
    if (e.keyCode == 110 || e.keyCode == 188) {
        e.stopEvent();
    }
}

 

  • Like 1
Posted
54 minutes ago, Nadya said:

And I need to set the value increment to 1. Because while I press and hold an arrow of my control, the value increasing/decreasing continiously.

?

Posted
14 hours ago, Sherzod said:

UniSpinEdit.ClientEvents.UniEvents ->


function beforeInit(sender, config)
{
    config.allowDecimals=false;
    config.allowExponential=false;
}

UniSpinEdit.ClientEvents.ExtEvents ->


function keydown(sender, e, eOpts)
{
    if (e.keyCode == 110 || e.keyCode == 188) {
        e.stopEvent();
    }
}

I added this code to Clients events of my spinedit named "seYear".

Now if I manually change text in the spinedit, for example, 2020.2, in debugger seYear.Value = 2020, if I print 2020.7, seYear.Value = 2021. Looks like value is just rounded.

Would by great if component wil not allow event print decimal values, maybe something like editmask or so

SpinEdit with decimal point

14 hours ago, Sherzod said:
15 hours ago, Nadya said:

And I need to set the value increment to 1. Because while I press and hold an arrow of my control, the value increasing/decreasing continiously.

?

Sorry maybe I explained wrong. Every time seYear value is changed I refresh data for selected year. So if I briefly click on arrow key (up for example) of spinedit - it's ok, data refreshed for next selected year value.

But If I press and hold arrow key of spinedit for some time, values in it change one by one, until max value (2050) is reached. And for every value from 2020 to 2050 refreshing of data happens. Mayby there is some way to disable this behaviour? I understand that I'm doing something wrong but can't see what exactly :-) Thank for your attention and help!

Posted
1 hour ago, Nadya said:

Sorry maybe I explained wrong. Every time seYear value is changed I refresh data for selected year. So if I briefly click on arrow key (up for example) of spinedit - it's ok, data refreshed for next selected year value.

But If I press and hold arrow key of spinedit for some time, values in it change one by one, until max value (2050) is reached. And for every value from 2020 to 2050 refreshing of data happens. Mayby there is some way to disable this behaviour?

Hi Nadya,

Use this config:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSpinEdit1.JSInterface.JSConfig('repeatTriggerClick', [False]);
end;

 

  • Like 1
Posted
1 hour ago, Sherzod said:

Use this config:


procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSpinEdit1.JSInterface.JSConfig('repeatTriggerClick', [False]);
end;

It's brilliant, that's exactly what i need!

Thank you!!!

  • Like 1

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...