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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Delphi Programming question

Hello!
Using TStringGrid component I want to move more than
one row in the grid.
How can I do that with D1?

Thanks,
   Tom

P.S.
Hello Ian!
Moving in my problem means I select more than 1 row in the StringGrid and like to move them lets say 1..n row to the top or
the bottom of the grid e.g. rows 10..15 are selected and I want to move them to row 2..7!!

Thanks for your ideas,
   Tom


0
ThomasG
Asked:
ThomasG
1 Solution
 
icampbe1Commented:
Unless you're a bit more clear, your probably gonna get some smart ass answers like:  Using the scroll bar lets you move them all.  
What do you mean by move?

Ian C.
0
 
ThomasGAuthor Commented:
Edited text of question
0
 
gk082597Commented:
Hi,

In delphi 2 i should do it like this (on top of my head, not tested)

procedure TStringGrid1.MoveMultRows(FromRow,ToRow,NRow:Intger);
var
  i:Integer;
begin
  //Moving rows Down
  if ToRow>FromRow+Nrow then
    For i:=1 to Nrow do MoveRow(FromRow,ToRow);
  // Moving Rows Up
  if ToRow<FromRow then
    For i:=1 to Nrow do MoveRow(FromRow+NRow,ToRow);
//  if FromRow=FromRow then; do nothing
  if (ToRow>FromRow) and (ToRow<=FromRow+NRow) then
     MoveMultRows(FromRow+NRow+1,FromRow,ToRow-FRomRow);
// Recursive call, I did not run it my self so you might
// want to be carefull here.

end;

The Called MoveRow is a function of TCustomStringGrid (i think)
of which TString grid is derived.

Hope this help you on your way

GK
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now