- Relect selection of the random tile list with the normal list list (fixes #51)

This commit is contained in:
Andreas Schneider 2009-12-10 16:54:43 +01:00
parent 5a2cde2ac8
commit 59ab7046c4
2 changed files with 34 additions and 1 deletions

View File

@ -16,7 +16,7 @@ object frmMain: TfrmMain
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
SessionProperties = 'acFlat.Checked;acNoDraw.Checked;Height;Left;mnuFlatShowHeight.Checked;tbStatics.Down;tbTerrain.Down;Top;Width;WindowState;mnuShowAnimations.Checked;mnuSecurityQuestion.Checked'
SessionProperties = 'acFlat.Checked;acNoDraw.Checked;Height;Left;mnuFlatShowHeight.Checked;mnuSecurityQuestion.Checked;mnuShowAnimations.Checked;tbStatics.Down;tbTerrain.Down;Top;Width;WindowState;spTileList.Top'
ShowInTaskBar = stAlways
LCLVersion = '0.9.29'
WindowState = wsMaximized
@ -507,6 +507,7 @@ object frmMain: TfrmMain
TabOrder = 0
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect]
OnClick = vdtRandomClick
OnDragOver = vdtRandomDragOver
OnDragDrop = vdtRandomDragDrop
OnDrawNode = vdtTilesDrawNode

View File

@ -238,6 +238,7 @@ type
procedure tmGrabTileInfoTimer(Sender: TObject);
procedure tmMovementTimer(Sender: TObject);
procedure tmTileHintTimer(Sender: TObject);
procedure vdtRandomClick(Sender: TObject);
procedure vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject;
DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState;
Pt: TPoint; var Effect: Integer; Mode: TDropMode);
@ -1405,6 +1406,37 @@ begin
tmTileHint.Enabled := False;
end;
procedure TfrmMain.vdtRandomClick(Sender: TObject);
var
node: PVirtualNode;
tileInfo: PTileInfo;
selectedID: Integer;
begin
if vdtRandom.SelectedCount = 1 then
begin
node := vdtRandom.GetFirstSelected;
if node <> nil then
begin
tileInfo := vdtRandom.GetNodeData(node);
selectedID := tileInfo^.ID;
node := vdtTiles.GetFirst;
while node <> nil do
begin
tileInfo := vdtTiles.GetNodeData(node);
if tileInfo^.ID = selectedID then
begin
vdtTiles.ClearSelection;
vdtTiles.Selected[node] := True;
vdtTiles.FocusedNode := node;
node := nil;
end else
node := vdtTiles.GetNext(node);
end;
end;
end;
end;
procedure TfrmMain.vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject;
DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState;
Pt: TPoint; var Effect: Integer; Mode: TDropMode);