Jump to content

Event for MinValue and MaxValue


bbm

Recommended Posts

Hi,

 

when I set the MinValue and the MaxValue of a UniSpinEdit and enter a Value outside these limits I will get the MaxValue as Value when I check the value parameter.

Example:

 

MinValue = 1  -->  MaxValue = 99  --> enter 100  --> reading the value parameter = 99

 

I want to show the user in a messagebox that one or more values are outside the limits.

How can I realize this? Is there any event available?

 

Best regards 

 

Link to comment
Share on other sites

Hi,

 

MinValue = 1  -->  MaxValue = 99  --> enter 100  --> reading the value parameter = 99

 

I want to show the user in a messagebox that one or more values are outside the limits.

How can I realize this? Is there any event available?

 

Can you explain a bit more ?

 

Or maybe you wanted like in "VCL" ?:

 

UniSpinEdit1 -> ClientEvents -> ExtEvents -> function blur:

function blur(sender, e, eOpts)
{
    var me=sender;
    if (me.value>me.maxValue) {
        me.setValue(me.maxValue);
    };    
}

Best regards,

Link to comment
Share on other sites

Hi,

 

this is exactly what I don't want to have.

The standard UniSpinEdit currently works like that:

 

Settings:

  • MinValue = 1
  • MaxValue = 10

Entering values directly with the keyboard:

  • entering -1  --> value = 1
  • entering 11 --> value = 10

 

I want to get the value that I entered into the input field. Then I can give a message to the operator.

Otherwise the value is within the limits (MinValue, MaxValue), the operator will not get any message and the wrong value will be stored in the database.

 

Best regards

Link to comment
Share on other sites

Ok,

 

Maybe like this?!:

 

1. UniSpinEdit1 -> ClientEvents -> ExtEvents -> function change:

function change(sender, newValue, oldValue, eOpts)
{
    ajaxRequest(sender, '_change', ["newValue="+newValue]);
}

2. UniSpinEdit1 -> OnAjaxEvent:

procedure TMainForm.UniSpinEdit1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_change' then
    (Sender as TUniSpinEdit).Tag := StrToInt(Params.Values['newValue'])
end;

3. Use:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniSpinEdit1 do
    if Tag > MaxValue then
      ShowMessage('Error...',
        procedure (Sender: TComponent; AResult:Integer)
        begin
          SetFocus;
        end
      );
end;
Link to comment
Share on other sites

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