[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Listview and Scrollbox with embeded Editboxes Scroll problem

Asked by WayneFischer in Delphi Programming

I have built a listview inside of a scrollbox and made it so that when you select a row it pulls up a panel with Editboxes in it that automaticaly size to the lisview row and alow you to edit the data in the row.

 Here is some of the code I am using to do this.

//Set Listbox To full Lenth
procedure TForm1.SetListViewSize(aListView:TListView);
var
 i, W, H: integer;
begin
  with aListView.Items[0].DisplayRect(drBounds)
    do H:=((Bottom-Top)+1) * aListView.Items.Count;

  W:=0;

  for i:=0 to aListView.Columns.Count-1
    do
   inc(W, aListView.Column[i].Width + 3);
   aListView.SetBounds(0, 0, W, H);
end;




//Load Listview
procedure TForm1.Button1Click(Sender: TObject);
begin
    ADOMain.SQL.Text := 'Select * From Items Where type = ''Labor''  order by Itemname';
    ADOMain.Open;

    ListView1.Items.Clear;
    while not ADOMain.Eof do begin
      NewItem := ListView1.Items.Add;
      NewItem.Data := Pointer(ADOMain.FieldByName('ItemID').AsInteger);
      NewItem.Caption := ADOMain.FieldByName('ItemName').AsString;
      NewItem.SubItems.Add(ADOMain.FieldByName('ItemDescription').AsString);
      ADOMain.Next;
    end;
    ADOMain.Close;
    SetListViewSize(ListView1);
end;




//Set Panel and editboxes into listview
procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  ColNum, nWdt: integer;
  R: TRect;
  LVI:TListItem;
begin

  PANEL1.Visible := True;

 with ListView1 do
   begin
    ColNum:=0;
    nWdt:=0;

  LVI:=GetItemAt(X, Y);

  if LVI <> nil then begin
      R:=LVI.DisplayRect(drLabel);
      Panel1.SetBounds(nWdt+Left+3,R.Top+Top+3,450, R.Bottom-R.Top);
  end;

  Panel1.BringToFront;

  if Assigned(ListView1.Selected) then begin
    Edit1.text := ListView1.Selected.Caption;
    Edit2.Text := ListView1.Selected.SubItems[0];
  end;

 end;

end;

When you scroll the scrollbox it keeps the panel and editboxes synonomus with the listview row you selected. All of this works great, however if you have a long list and you scroll the scrollbox down then select a row it automatically scrolls the scrollbox to where the selected row is the last row in the scrollbox. I need the scrollbox to not change but leave the selected row exactally where it was selected.
[+][-]12/05/04 07:56 AM, ID: 12748565Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Delphi Programming
Sign Up Now!
Solution Provided By: MFriese
Participating Experts: 2
Solution Grade: A
 
[+][-]12/05/04 01:00 PM, ID: 12749656Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]12/05/04 04:12 PM, ID: 12750389Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/05/04 05:28 PM, ID: 12750610Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/05/04 11:08 PM, ID: 12751715Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/06/04 07:50 AM, ID: 12755019Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/07/04 09:25 AM, ID: 12766148Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/24/05 02:54 AM, ID: 13391244Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02/28/05 07:38 PM, ID: 13426108Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89