Jump to content

Newbie String Grid questions


david_navigator

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...