david_navigator Posted June 7, 2018 Share Posted June 7, 2018 Sorry if these are obvious to seasoned users, but there are somethings that I can do in VCL string grid that I can't work out how to do in a UniStringGrid. Are they possible or are there maybe different ways to achieve something similar ? Should I be doing some of this via Client Events - something new to me that I don't really understand ?1. A KeyDown/KeyPress event - there doesn't seem to be anyway to find what the user is typing. 2. Is it possible to draw an image (or render a standard icon) in a cell (not all rows) ? 3. Is it possible to highlight the content of a cell being edited so that what the user types replaces the current content without having the user hit delete or backspace ? Many thanks David Quote Link to comment Share on other sites More sharing options...
david_navigator Posted June 8, 2018 Author Share Posted June 8, 2018 OK 1. I thought I could do something like this function keypress(e, t, eOpts) { var mychar = e.keyCode; if(mychar == 43){ event.preventDefault(); alert('+ Presssed'); } else if(mychar == 45){ event.preventDefault(); alert('- Presssed'); } else alert("heres the value:" + mychar); ajaxRequest(null, '_keypress', ['key='+mychar]); } but this doesn't trigger the OnAjaxEvent, so obviously that's not correct. (alerts are just my debug code obviously)Actually what I want to do is change the value in a cell in a UniStringGrid - so if the StringGrid keyPress is a + then increment cell[current_row, 0] value and if it's a -, decrement it. But how do I refer to the cell in javaScript ?Any help or hints greatly appreciated.(This is the trial version if it makes any difference) Quote Link to comment Share on other sites More sharing options...
david_navigator Posted June 8, 2018 Author Share Posted June 8, 2018 Ah, sending the component instead of null seems to work So next, working out how to write to the StringGrid in the Client Event. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2018 Share Posted June 8, 2018 Hello, So next, working out how to write to the StringGrid in the Client Event. Are you still using a trial edition? Can you explain in more details what you wanted?! Quote Link to comment Share on other sites More sharing options...
david_navigator Posted June 8, 2018 Author Share Posted June 8, 2018 Hi yes, still using the trial edition. My boss wants to see a working prototype before he'll let me buy the full version (he got stung before with a competitor product).I have a string grid. Column 0 contains an integer. The use can navigate around the string grid using the arrow keys on the keyboard. This is normal behaviour. If the user hits the + or - key on the keyboard, then I want to increment or decrement the value in column 0 in the current row. Now that I've got the OnAjax event working, I can just use delphi to change the value of the cell, but I'm thinking it would be better to do that in javascript, client side. Is this right or does it make very little difference ? 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.