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

View File

@ -59,6 +59,9 @@ type
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
State: TOwnerDrawState); State: TOwnerDrawState);
procedure lbHueSelectionChange(Sender: TObject; User: boolean); 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 public
function GetHue: Word; function GetHue: Word;
public public
@ -153,6 +156,19 @@ begin
edHue.Text := Format('$%x', [lbHue.ItemIndex]); edHue.Text := Format('$%x', [lbHue.ItemIndex]);
end; 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; function TfrmHueSettings.GetHue: Word;
begin begin
if cbRandom.Checked and (lbRandom.Items.Count > 0) then if cbRandom.Checked and (lbRandom.Items.Count > 0) then