ich habe einen nervigen bug in der VST Enteckt und zwar:
erstelle ich zur lauf zeit mit diesem code eine VST Komponente:
Code: Alles auswählen
procedure TForm1.AddPanel(PCaption:String);
var
pl,pl1,pl2:TPanel;
i,px,py:Integer;
sp,sp1,sp2,sp3:TSpeedButton;
lb,lb1:TLabel;
cb:TComboBox;
vst:TVirtualStringTree;
begin
inc(Index); px:=0; py:=0;
PCaption:=PCaption+IntTostr(index);
// if GetFreePos
pl:=TPanel.Create(ScrollBox1); pl.Parent:=ScrollBox1;
pl.Width:=308; pl.Height:=406;
if nx+1 < mx then
inc(nx)
else begin
nx:=0;
inc(ny);
end;
px:=px+((pl.Width+5)*nx);
// if ny > -1 then
py:=py+((pl.Height+5)*ny);
//else
//py:=0;
Caption:=IntTostr(nx) + '\' + IntTostr(ny);
pl.Left:=px; pl.Top:=py; pl.Tag:=index;
// Das Erste Panel wird erstellt
pl1:=TPanel.Create(pl); pl1.Parent:=pl; pl1.Visible:=True;
pl1.left:=0; pl1.top:=0; pl1.Width:=306; pl1.Height:=24;
pl1.Align:=alTop;
// Komponenten zum Erste Panel hinzufügen
// Die Speed Buttons werden erstellt
sp:=TSpeedButton.Create(pl1); sp.Parent:=pl1; sp.Caption:='&X';
sp.Left:=280; sp.Top:=0; sp.Width:=23; sp.Height:=22; sp.tag:=1;
sp.OnClick:=@SPClick;
sp1:=TSpeedButton.Create(pl1); sp1.Parent:=pl1; sp1.Caption:='&M';
sp1.Left:=253; sp1.Top:=0; sp1.Width:=23; sp1.Height:=22; sp1.tag:=2;
sp1.OnClick:=@SPClick;
sp2:=TSpeedButton.Create(pl1); sp2.Parent:=pl1; sp2.Caption:='&V';
sp2.Left:=225; sp2.Top:=0; sp2.Width:=23; sp2.Height:=22; sp2.Tag:=3;
sp2.OnClick:=@SPClick;
// Label wird erstellt
lb:=TLabel.Create(pl1); lb.Parent:=pl1; lb.Caption:=PCaption;
lb.Left:=0; lb.Top:=0; lb.Width:=225; lb.Height:=17;
// Komponenten zum zweiten Panel hinzufügen
pl2:=TPanel.Create(pl); pl2.Parent:=pl; pl2.Visible:=True;
pl2.left:=0; pl2.top:=25; pl2.Width:=306; pl2.Height:=60;
pl2.Align:=alTop;
lb1:=TLabel.Create(pl2); lb1.Parent:=pl2; lb1.Caption:='Verzeichnis';
lb1.Left:=6; lb1.Top:=4; lb1.Width:=83; lb1.Height:=17;
cb:=TComboBox.Create(pl2); cb.Parent:=pl2;
cb.Left:=6; cb.Top:=23; cb.Width:=265; cb.Height:=25;
cb.Text:='/media/hda7/';
sp3:=TSpeedButton.Create(pl2); sp3.Parent:=pl2; sp3.Caption:='...';
sp3.Left:=277; sp3.Top:=23; sp3.Width:=23; sp3.Height:=22; sp3.tag:=4;
sp3.OnClick:=@SPClick;
// VST zum hintergrund Panel hinzufügen
vst:=TVirtualStringTree.Create(pl); vst.Parent:=pl;
vst.left:=6; vst.top:=90; vst.Width:=290; vst.Height:=300;
vst.ScrollBarOptions.AlwaysVisible:=True;
vst.NodeDataSize:=SizeOF(TDir);
vst.OnGetText:=@listeGetText;
with ListView1.Items.add do begin
Caption:=PCaption;
SubItems.Add('1');
end;
end;
Code: Alles auswählen
procedure TForm1.AddVST(Vst:TVirtualStringTree;pCaption,FileName:String);
var
node:PVirtualNode;
dir:pDir;
begin
writeln(Filename, '|',pCaption);
node:=vst.AddChild(nil);
node^.CheckState:=csCheckedNormal;
node^.CheckType:=ctCheckBox;
dir:=vst.GetNodeData(node);
dir^.caption:=pCaption;
dir^.FileName:=Filename;
dir^.TempName:='';
dir^.dir:=Filename
end;
Code: Alles auswählen
pl1:=TPanel(TPanel(TPanel(TSpeedButton(Sender)).Parent).Parent);
vst:=TVirtualStringTree(pl1.Controls[2]);
cb:=TCombobox(TPanel(TSpeedButton(Sender)).Parent.Controls[2]);
caption:=cb.Text;
LoadDir(cb.text,vst);