Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#1

from TListView to VirtualStringTree

  Alt 13. Jul 2009, 16:10
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 ?
  Mit Zitat antworten Zitat