Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi from TListView to VirtualStringTree (https://www.delphipraxis.net/137062-tlistview-virtualstringtree.html)

mohfa 13. Jul 2009 16:10


from TListView to VirtualStringTree
 
hi i use the following Code with the TListView :
Delphi-Quellcode:
// LV := TListView
procedure TForm1.umQUARPROPMSG(var Msg: TMessage);
var
  Item : TListItem;
  i : integer;
  res : boolean;
  info : TMyInfo;
begin
  Msg.Result := 1;
  res := Msg.LParam = 0;

 
    Item := lv.Selected;

    if Item <> nil then begin
      i := Item.Index;
      if Msg.LParam <> 0 then
        Inc(i, Msg.LParam)
      else
        Inc(i, Msg.WParam);

      if (i < 0) or (i >= lv.Items.Count) then
        Msg.Result := 0
      else begin
        Item := lv.Items[i];

        lv.Selected := Item;
        Item.MakeVisible(false);
        Item.Focused := true;
        Update;

        if res then begin
          info := TMyInfo(Item.Data);
          with FMyInfo as TMyIndo do begin

            info.GetInfoText(Memo1.Lines, Memo1.ClientWidth -8, Memo1.Font);

            Memo1.SelStart := 0;
            Memo1.SelLength := 0;
          end;
        end;
      end;

   

  end;
end;
But when i apply it with the TVirtualStringTree like this :
Delphi-Quellcode:
//Vst:=TVirtualStringTree
procedure TForm1.umQUARPROPMSG_(var Msg: TMessage);
var
 // Item : TListItem;

  Node: PVirtualNode;
  Data: PTreeData;
  i : integer;
  res : boolean;
  info : TMyInfo;
begin
  Msg.Result := 1;
  res := Msg.LParam = 0;

  //  Item := lv.Selected;
     Node:=VST.FocusedNode;
    Data:=VST.GetNodeData(Node);

    if Node <> nil then begin
    i:=node.Index;

     // i := Item.Index;
      if Msg.LParam <> 0 then
        Inc(i, Msg.LParam)
      else
        Inc(i, Msg.WParam);

      if (i < 0) or (i >=vst.TotalCount)then
        Msg.Result := 0
      else begin

       // Item := lv.Items[i];
       vst.FocusedNode:=node;

       vst.Focused;

      //  lv.Selected := Item;
      //  Item.MakeVisible(false);
      //  Item.Focused := true;
        Update;

        if res then begin
          info := TMyInfo(data);
          with FMyInfo as TMyInfo do begin

            info.GetInfoText(Memo1.Lines, Memo1.ClientWidth -8, Memo1.Font);
            Memo1.SelStart := 0;
            Memo1.SelLength := 0;
          end;
        end;
      end;

 

  end;
end;
that doesn't give the same result .
Is there any error with Code used in VST ?

chaosben 13. Jul 2009 17:44

Re: from TListView to VirtualStringTree
 
What do you mean with
Zitat:

Zitat von mohfa
that doesn't give the same result .

? :gruebel:

mohfa 13. Jul 2009 18:02

Re: from TListView to VirtualStringTree
 
thank you chaosben

i meant the result is not the same as with the TListView .

the code does a TListView auto-scroll from a Second Form where i have 2 buttons ( UP_Scroll and DOWN_Scroll ) of course via the Msg .

the code works good with the TListView and i can see the UP_scroll and DOWN_scroll with IT . but with TVirtualStringTree :wall:

if you want i can attache a little sample of IT ?

generic 13. Jul 2009 18:46

Re: from TListView to VirtualStringTree
 
tell me what your function should do, please.

i'm sure there is a much simpler way in vst style.


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz