- Added Drag&Drop for random hue list (refs #66)

This commit is contained in:
Andreas Schneider 2011-03-12 22:58:54 +01:00
parent ae720d1931
commit fd4155a45b
2 changed files with 19 additions and 0 deletions

View File

@ -48,6 +48,7 @@ inherited frmHueSettings: TfrmHueSettings
Width = 209
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 8
DragMode = dmAutomatic
Font.Height = 14
ItemHeight = 16
OnDrawItem = lbHueDrawItem
@ -365,6 +366,8 @@ inherited frmHueSettings: TfrmHueSettings
BorderSpacing.Around = 4
ItemHeight = 0
MultiSelect = True
OnDragDrop = lbRandomDragDrop
OnDragOver = lbRandomDragOver
OnDrawItem = lbHueDrawItem
TabOrder = 1
end

View File

@ -59,6 +59,9 @@ type
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
State: TOwnerDrawState);
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
procedure lbRandomDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure lbRandomDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
public
function GetHue: Word;
public
@ -153,6 +156,19 @@ begin
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
end;
procedure TfrmHueSettings.lbRandomDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
if Source = lbHue then
btnAddRandomClick(Sender);
end;
procedure TfrmHueSettings.lbRandomDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
if Source = lbHue then Accept := True;
end;
function TfrmHueSettings.GetHue: Word;
begin
if cbRandom.Checked and (lbRandom.Items.Count > 0) then