eduardosuruagy Posted December 11, 2018 Share Posted December 11, 2018 How do I validate a value from a stringgrid? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2018 Share Posted December 11, 2018 Just now, eduardosuruagy said: How do I validate a value from a stringgrid? Hello, Please explain in more details Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 11, 2018 Author Share Posted December 11, 2018 I need only to enter values Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2018 Share Posted December 11, 2018 Do you mean the numbers? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 11, 2018 Author Share Posted December 11, 2018 I want to validate these values at the time the user types and presses an enter. Remembering that he can not change the last line. And I would also like to align those values to the right. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 12, 2018 Author Share Posted December 12, 2018 ?? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 12, 2018 Share Posted December 12, 2018 7 minutes ago, eduardosuruagy said: ?? Sorry, please give more details How do you want to check the value? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 12, 2018 Author Share Posted December 12, 2018 Or when the user gives an enter and goes to another cell or when the focus leaves the cell. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 8 hours ago, eduardosuruagy said: Or when the user gives an enter and goes to another cell or when the focus leaves the cell. I will try to analyze and let you know Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 13, 2018 Share Posted December 13, 2018 1 hour ago, Sherzod said: I will try to analyze and let you know Maybe something like this as one of the possible solutions 1. UniStringGrid -> ClientEvents -> ExtEvents -> function edit(editor, context, eOpts): function edit(editor, context, eOpts) { var ctx=context; ajaxRequest(this, '_edit', [ 'rowIdx='+ctx.rowIdx, 'colIdx='+ctx.colIdx, 'oldValue='+ctx.originalValue, 'newValue='+ctx.value ] ); } 2. UniStringGrid -> OnAjaxEvent: procedure TMainForm.UniStringGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var rowIdx, colIdx: Integer; oldValue, newValue: string; begin if EventName = '_edit' then begin // some conditions if (Params.Values['rowIdx']<>'')and(Params.Values['colIdx']<>'') then begin rowIdx := StrToInt(Params.Values['rowIdx']); colIdx := StrToInt(Params.Values['colIdx']); oldValue := Params.Values['oldValue']; newValue := Params.Values['newValue']; // // some conditions // Params.Values['oldValue'] // Params.Values['newValue'] // (Sender as TUniStringGrid).Cells[colIdx, rowIdx] := ''; (Sender as TUniStringGrid).Cells[colIdx, rowIdx] := oldValue; end; end; end; Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 17, 2018 Author Share Posted December 17, 2018 On 12/13/2018 at 4:44 AM, Sherzod said: ar ctx=context; ajaxRequest(this, '_edit', [ 'rowIdx='+ctx.rowIdx, 'colIdx='+ctx.colIdx, 'oldValue='+ctx.originalValue, 'newValue='+ctx.value ] ); Thank you! 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.