Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TStringGrid event

Posted on 2000-05-11
4
Medium Priority
?
415 Views
Last Modified: 2008-02-26
Does anyone know how to make the focused item on a TStringGrid move, say one item down, when the user changes it's value? /like in MS Excel worksheet/
...perhaps onChange event would do the job, but it's not implemented in TStringGrid....
..any ideas?
TL
0
Comment
Question by:TL010600
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:jbodom
ID: 2801235
In Excel, you still have to tab or arrow to the next item.  TStringGrid supports this as part of the Options properties goEditing and goTabs
0
 

Author Comment

by:TL010600
ID: 2803851
Ya, but in Excel u dont have to navigate with the down key /by default/ to move to the next down position -> when a field is JUST edited the focused one is automaticaly moved down by one position...thats what I intend to do in C++ Builder....
0
 
LVL 1

Accepted Solution

by:
jbodom earned 400 total points
ID: 2804925
I'm guessing you're talking about after you hit the enter key.  If so, the following should help get you started.  Place this code in the TStringGrid KeyPress event handler:

void __fastcall TForm1::StringGrid1KeyPress(TObject *Sender, char &Key)
{
  if (StringGrid1->EditorMode && Key == VK_RETURN){
    if (StringGrid1->Row < StringGrid1->RowCount - 1)
      StringGrid1->Row = StringGrid1->Row + 1;
    else{
      if(StringGrid1->Col<StringGrid1->ColCount-1){
        StringGrid1->Row = StringGrid1->FixedRows;
        StringGrid1->Col = StringGrid1->Col + 1;
      }
      else{
        StringGrid1->Row=StringGrid1->FixedRows;
        StringGrid1->Col=StringGrid1->FixedCols;
      }
    }
  }
}
0
 

Author Comment

by:TL010600
ID: 2805326
ThanX! It seems to work!
..... thought the grid remains in edit mode, but I think I'll fix it! :)
TL
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question