Solved

Delphi Programming question

Posted on 1997-09-05
3
168 Views
Last Modified: 2010-04-04
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
Comment
Question by:ThomasG
3 Comments
 
LVL 2

Expert Comment

by:icampbe1
ID: 1343445
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
 

Author Comment

by:ThomasG
ID: 1343446
Edited text of question
0
 

Accepted Solution

by:
gk082597 earned 20 total points
ID: 1343447
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now