jahlxx Posted April 10, 2018 Share Posted April 10, 2018 Hi. How can I copy to clipboard a cell content of a dbgrid? Thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2018 Share Posted April 10, 2018 Hi, Sorry, for what purpose do you want to use this? And, wanted programmatically or manually? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 10, 2018 Author Share Posted April 10, 2018 some times, the user needs to copy a cell content and paste in other place. ctrl-C and ctrl-V Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2018 Share Posted April 10, 2018 Maybe you wanted like this?: http://forums.unigui.com/index.php?/topic/8543-copy-paste-tex-in-dbgrids/? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 10, 2018 Author Share Posted April 10, 2018 Sorry. I've tried it, but don't work Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2018 Share Posted April 10, 2018 Which build are you using? And indicate the steps to reproduce Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 10, 2018 Author Share Posted April 10, 2018 Unigui Vdersion: 1.0.0.1412 Only 1 step. Put that code in extevents unidbgrid -> clientevents->unievents: function beforeInit(sender, config){ config.viewConfig.enableTextSelection = true;} Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2018 Share Posted April 10, 2018 Do you want to copy in Browse mode?! Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 10, 2018 Author Share Posted April 10, 2018 Yes. Browse or edit mode. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10, 2018 Share Posted April 10, 2018 In Edit mode you can just select and press ctrl+c, what problem do you have?! Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 10, 2018 Author Share Posted April 10, 2018 yes, I know. how about in browse mode? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 11, 2018 Share Posted April 11, 2018 Hi, how about in browse mode? OK, let's look at this rough approach 1. UniMemo2: Left = -1000 2. UniDBGrid -> ClientEvents -> ExtEvents -> function afterrender: function afterrender(sender, eOpts) { var me = sender, tempCopyEl = MainForm.UniMemo2; me.el.addKeyMap({ key: 67, ctrl: true, fn: function() { tempCopyEl.setValue(me.getSelectionModel().getSelection()[0].data[1]); // value of the second cell, the possibility of arbitrary copying can be expanded here! tempCopyEl.focus(); tempCopyEl.selectText(); document.execCommand('copy'); } }) } Now try Best regards, Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 12, 2018 Author Share Posted April 12, 2018 Sorry. Your code is not clear for me Is not possible select text like in any other web page? I've also tested with: Clipboard.AsText := SomeStringData_Variable; But don't work in isapi dll, only works in standalone. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2018 Share Posted April 12, 2018 Hi, Is not possible select text like in any other web page? Sorry, for example? I've also tested with:Clipboard.AsText := SomeStringData_Variable; But don't work in isapi dll, only works in standalone. In web programming, forget about this approach Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 12, 2018 Author Share Posted April 12, 2018 For example?. Enter in any page, ant try to select text, left button of mouse and mantain le left button pressed until you ends selection do ctrl-c go to notepad and paste Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 12, 2018 Author Share Posted April 12, 2018 I've seen this: http://forums.unigui.com/index.php?/topic/8543-copy-paste-tex-in-dbgrids/?hl=enabletextselection&do=findComment&comment=43965 and this http://forums.unigui.com/index.php?/topic/9450-showmessage-copy/ but nothing work Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2018 Share Posted April 12, 2018 I've seen this: http://forums.unigui.com/index.php?/topic/8543-copy-paste-tex-in-dbgrids/?hl=enabletextselection&do=findComment&comment=43965 Yes it works Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2018 Share Posted April 12, 2018 I've seen this: http://forums.unigui.com/index.php?/topic/8543-copy-paste-tex-in-dbgrids/?hl=enabletextselection&do=findComment&comment=43965 Yes it works Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 12, 2018 Author Share Posted April 12, 2018 Ok. Then something must be wrong in my projects, because none of this works. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2018 Share Posted April 12, 2018 Ok. Then something must be wrong in my projects, because none of this works. Can you make a simple testcase for this? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted April 13, 2018 Author Share Posted April 13, 2018 Ok. The problem is in my grids: readonly=true dgediting=false If I put readonly false and dgediting true, works, and the script in your post #12 is not needed. This is not a good solution for me. Any other idea? 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.