bbm Posted December 20, 2017 Share Posted December 20, 2017 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 20, 2017 Share Posted December 20, 2017 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, Quote Link to comment Share on other sites More sharing options...
bbm Posted December 20, 2017 Author Share Posted December 20, 2017 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 20, 2017 Share Posted December 20, 2017 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; Quote Link to comment Share on other sites More sharing options...
bbm Posted December 21, 2017 Author Share Posted December 21, 2017 Hi, perfect, this is exactly what I wanted Best regards and many thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.