Ulugbek Posted July 22, 2013 Share Posted July 22, 2013 Hi All can you help me TUniDbgrid how get cell value and column name from cell? Quote Link to comment Share on other sites More sharing options...
mhmda Posted July 22, 2013 Share Posted July 22, 2013 procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn); var val:string; clmn_name:string; begin val:=Column.Field.AsString; clmn_name:=Column.FieldName; end; Quote Link to comment Share on other sites More sharing options...
Ulugbek Posted July 22, 2013 Author Share Posted July 22, 2013 10x Mohammad How with button click get not cell click .. I try this but this work only first column procedure TMainForm.est1Click(Sender: TObject); var val1:string; clmn_name1:string; begin val1:=UniDBGrid1.Columns[0].Field.AsString; clmn_name1:=UniDBGrid1.Columns[0].Field.FieldName; ShowMessage(Concat(val1,' ',clmn_name1)); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 23, 2013 Share Posted July 23, 2013 Hi Ulugbek. Try this: type TDBGridHack = class(TuniDBGrid) private function GetCurrCol: Integer; end; function TDBGridHack.GetCurrCol: Integer; begin Result := CurrCol; end; procedure TMainForm.UniBitBtn1Click(Sender: TObject); var i: Integer; begin i := TDBGridHack(UniDBGrid1).GetCurrCol; ShowMessage(UniDBGrid1.Columns[i].Field.AsString + ' ' + UniDBGrid1.Columns[i].FieldName); end; Quote Link to comment Share on other sites More sharing options...
Ulugbek Posted July 24, 2013 Author Share Posted July 24, 2013 big thank's Quote Link to comment Share on other sites More sharing options...
M477H13U Posted July 20, 2018 Share Posted July 20, 2018 Hello there ! (: is it possible to access the value of a the current cell in onKeyDown event ? Here's the use case: I'm in my cell, updating my value I press for instance F3 key for a specific action I obtain the cell value (the dataSource have not been update yet so UniDBGrid1.Columns[i].Field.AsString give the old value!) Do my stuff. How my I obtain the cell value ? Regards, Quote Link to comment Share on other sites More sharing options...
M477H13U Posted August 6, 2018 Share Posted August 6, 2018 Up ! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 6, 2018 Share Posted August 6, 2018 Hi, Hello there ! (: is it possible to access the value of a the current cell in onKeyDown event ? Here's the use case: I'm in my cell, updating my value I press for instance F3 key for a specific action I obtain the cell value (the dataSource have not been update yet so UniDBGrid1.Columns[i].Field.AsString give the old value!) Do my stuff. How my I obtain the cell value ? Regards, Sorry, can you make a simple testcase for this?.. Quote Link to comment Share on other sites More sharing options...
M477H13U Posted September 20, 2018 Share Posted September 20, 2018 Hello Sherzod! Sorry for the delay, I did not had time to manage this issue. You can find bellow a testCase that highlight the issue I am talking about ! Can't wait to read you ! TestGridEdit+KeyDown.7z Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 31, 2018 Share Posted October 31, 2018 Hello there uniGUI ! Did you have the time to check my simple test case ? I am looking forward for a solution! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 Hello, Sorry for the delay, Can you make a simple testcase without "SQLite" ?! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 15 minutes ago, Sherzod said: Can you make a simple testcase without "SQLite" ?! Ok, sorry, test case is not needed Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 31, 2018 Share Posted October 31, 2018 Hello Sherzod ! What do you suggest then ? (: Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 Hello, It seems you quickly select and at the same time press key Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 31, 2018 Share Posted October 31, 2018 Indeed, I am quiclkly editing a cell and by pressing my Key, I would like to extract the new value. It is done with TUniStringGrid.Cell[Row, Col] Is there a way to achieve the same thing with uniDBGrid ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 Just for an additional info, can you make a gif file... How are you editing and pressing? Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 31, 2018 Share Posted October 31, 2018 Have you even open my project ? Everything is detailed in the header of the form .. Anyhow, here's the gif you asked Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 Ok, thx for the gif, I will check... 1 Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 31, 2018 Share Posted October 31, 2018 Thanks for the quick answer Looking forward to see your workaround Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2018 Share Posted October 31, 2018 Perhaps this solution is not very suitable for you, but try this "workaround": 1. UniDBGrid -> OnKeyDown, do not use this event: procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin // do not use this event // if Key = vk_F4 then // begin // ShowMessage('Cell value is '''+UniDBGrid1.Columns[UniDBGrid1.CurrCol].Field.AsString+'''.'); // end; end; 2. UniDBGrid -> ClientEvents -> ExtEvents -> function reconfigure: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns.forEach(function(col) { if (col.getEditor()) { col.getEditor().on('keydown', function(field, e) { if (e.keyCode == 115) { // keyCode can also be passed ajaxRequest(sender, '_keydown', ['val=' + field.value]) } }) } }) } 3. UniDBGrid -> OnAjaxEvent: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_keydown' then ShowMessage(Params.Values['val']); end; Quote Link to comment Share on other sites More sharing options...
M477H13U Posted November 5, 2018 Share Posted November 5, 2018 Hey Sherzod, thanks for the answer !! There is a problem with editor's event : col.getEditor().on('keydown', function(field, e) { as it is never fired! Did I miss something ??:O But I managed to extract field value with this code, if anyone need it ! function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns.forEach(function(col){ if(col.getEditor()){ console.log(col.getEditor()); sender.on('keydown', function(e, t, eOpts){ console.log(e.keyCode); if(e.keyCode == 115){ ajaxRequest(sender, '_keydown', ['val='+col.field.value]); } }) } }) } On 10/31/2018 at 8:27 PM, Sherzod said: Perhaps this solution is not very suitable for you I am going to validate this with my manager and give you a feedback on that solution ! (: 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.