mbColorLib: Make sure that Enabled of all properties is working. Minor refatoring of mbColorPalette(Use LCL methods instead of message handlers).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5517 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-16 14:51:45 +00:00
parent 8baa12ec3b
commit 0563e04bea
3 changed files with 173 additions and 80 deletions

View File

@ -1,10 +1,10 @@
object Form1: TForm1 object Form1: TForm1
Left = 447 Left = 447
Height = 376 Height = 397
Top = 197 Top = 197
Width = 539 Width = 539
Caption = 'mbColor Lib v2.0.1 Demo' Caption = 'mbColor Lib v2.0.1 Demo'
ClientHeight = 376 ClientHeight = 397
ClientWidth = 539 ClientWidth = 539
Font.Color = clWindowText Font.Color = clWindowText
OnCreate = FormCreate OnCreate = FormCreate
@ -38,14 +38,15 @@ object Form1: TForm1
ParentColor = False ParentColor = False
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 6 Left = 8
Height = 363 Height = 384
Top = 6 Top = 6
Width = 403 Width = 403
ActivePage = TabSheet3 ActivePage = TabSheet10
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 2 TabIndex = 10
TabOrder = 0 TabOrder = 0
OnChange = PageControl1Change
OnMouseMove = PageControl1MouseMove OnMouseMove = PageControl1MouseMove
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'HSLColorPicker' Caption = 'HSLColorPicker'
@ -67,7 +68,7 @@ object Form1: TForm1
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'HexaColorPicker' Caption = 'HexaColorPicker'
ClientHeight = 335 ClientHeight = 356
ClientWidth = 395 ClientWidth = 395
ImageIndex = 1 ImageIndex = 1
object Label4: TLabel object Label4: TLabel
@ -75,14 +76,14 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 112 Left = 112
Height = 15 Height = 15
Top = 314 Top = 335
Width = 40 Width = 40
Caption = 'Marker:' Caption = 'Marker:'
ParentColor = False ParentColor = False
end end
object HexaColorPicker1: THexaColorPicker object HexaColorPicker1: THexaColorPicker
Left = 48 Left = 48
Height = 303 Height = 324
Top = 4 Top = 4
Width = 289 Width = 289
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -100,7 +101,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 4 Left = 4
Height = 19 Height = 19
Top = 312 Top = 333
Width = 83 Width = 83
Caption = 'SliderVisible' Caption = 'SliderVisible'
Checked = True Checked = True
@ -111,7 +112,7 @@ object Form1: TForm1
object ComboBox1: TComboBox object ComboBox1: TComboBox
Left = 160 Left = 160
Height = 23 Height = 23
Top = 310 Top = 331
Width = 71 Width = 71
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
ItemHeight = 15 ItemHeight = 15
@ -130,7 +131,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 256 Left = 256
Height = 20 Height = 20
Top = 311 Top = 332
Width = 101 Width = 101
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
Caption = 'NewArrowStyle' Caption = 'NewArrowStyle'
@ -140,7 +141,7 @@ object Form1: TForm1
end end
object TabSheet3: TTabSheet object TabSheet3: TTabSheet
Caption = 'mbColorPalette' Caption = 'mbColorPalette'
ClientHeight = 335 ClientHeight = 356
ClientWidth = 395 ClientWidth = 395
ImageIndex = 2 ImageIndex = 2
object Label3: TLabel object Label3: TLabel
@ -148,7 +149,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 15
Top = 304 Top = 325
Width = 24 Width = 24
Caption = 'Sort:' Caption = 'Sort:'
ParentColor = False ParentColor = False
@ -158,7 +159,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 224 Left = 224
Height = 15 Height = 15
Top = 304 Top = 325
Width = 28 Width = 28
Caption = 'Style:' Caption = 'Style:'
ParentColor = False ParentColor = False
@ -168,7 +169,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 336 Left = 336
Height = 15 Height = 15
Top = 304 Top = 325
Width = 23 Width = 23
Caption = 'Size:' Caption = 'Size:'
ParentColor = False ParentColor = False
@ -176,7 +177,7 @@ object Form1: TForm1
object Button1: TButton object Button1: TButton
Left = 6 Left = 6
Height = 25 Height = 25
Top = 268 Top = 289
Width = 107 Width = 107
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Generate blue pal' Caption = 'Generate blue pal'
@ -186,7 +187,7 @@ object Form1: TForm1
object Button2: TButton object Button2: TButton
Left = 120 Left = 120
Height = 25 Height = 25
Top = 268 Top = 289
Width = 135 Width = 135
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Generate gradient pal' Caption = 'Generate gradient pal'
@ -196,7 +197,7 @@ object Form1: TForm1
object Button4: TButton object Button4: TButton
Left = 262 Left = 262
Height = 25 Height = 25
Top = 268 Top = 289
Width = 121 Width = 121
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Load palette from file' Caption = 'Load palette from file'
@ -205,21 +206,21 @@ object Form1: TForm1
end end
object ScrollBox1: TScrollBox object ScrollBox1: TScrollBox
Left = 6 Left = 6
Height = 253 Height = 274
Top = 8 Top = 8
Width = 385 Width = 385
HorzScrollBar.Page = 385 HorzScrollBar.Page = 75
VertScrollBar.Page = 250 VertScrollBar.Page = 50
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderStyle = bsNone BorderStyle = bsNone
ClientHeight = 253 ClientHeight = 274
ClientWidth = 385 ClientWidth = 385
TabOrder = 3 TabOrder = 3
object mbColorPalette1: TmbColorPalette object mbColorPalette1: TmbColorPalette
Left = 0 Left = 0
Height = 250 Height = 271
Top = 0 Top = 0
Width = 385 Width = 378
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Colors.Strings = ( Colors.Strings = (
'clBlack' 'clBlack'
@ -489,7 +490,7 @@ object Form1: TForm1
object ComboBox2: TComboBox object ComboBox2: TComboBox
Left = 34 Left = 34
Height = 23 Height = 23
Top = 300 Top = 321
Width = 87 Width = 87
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
ItemHeight = 15 ItemHeight = 15
@ -506,7 +507,7 @@ object Form1: TForm1
object ComboBox3: TComboBox object ComboBox3: TComboBox
Left = 127 Left = 127
Height = 23 Height = 23
Top = 300 Top = 321
Width = 87 Width = 87
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
ItemHeight = 15 ItemHeight = 15
@ -539,7 +540,7 @@ object Form1: TForm1
object ComboBox4: TComboBox object ComboBox4: TComboBox
Left = 256 Left = 256
Height = 23 Height = 23
Top = 300 Top = 321
Width = 71 Width = 71
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
ItemHeight = 15 ItemHeight = 15
@ -556,7 +557,7 @@ object Form1: TForm1
object UpDown1: TUpDown object UpDown1: TUpDown
Left = 364 Left = 364
Height = 23 Height = 23
Top = 300 Top = 321
Width = 15 Width = 15
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Min = 0 Min = 0
@ -569,14 +570,14 @@ object Form1: TForm1
end end
object TabSheet4: TTabSheet object TabSheet4: TTabSheet
Caption = 'HSLRingPicker' Caption = 'HSLRingPicker'
ClientHeight = 303 ClientHeight = 356
ClientWidth = 391 ClientWidth = 395
ImageIndex = 3 ImageIndex = 3
object HSLRingPicker1: THSLRingPicker object HSLRingPicker1: THSLRingPicker
Left = 50 Left = 50
Height = 289 Height = 342
Top = 6 Top = 6
Width = 293 Width = 297
RingPickerHintFormat = 'Hue: %h' RingPickerHintFormat = 'Hue: %h'
SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex' SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex'
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -587,14 +588,14 @@ object Form1: TForm1
end end
object TabSheet5: TTabSheet object TabSheet5: TTabSheet
Caption = 'HSVColorPicker' Caption = 'HSVColorPicker'
ClientHeight = 303 ClientHeight = 356
ClientWidth = 391 ClientWidth = 395
ImageIndex = 4 ImageIndex = 4
object HSVColorPicker1: THSVColorPicker object HSVColorPicker1: THSVColorPicker
Left = 24 Left = 24
Height = 289 Height = 342
Top = 6 Top = 6
Width = 328 Width = 332
HintFormat = 'H: %h S: %s V: %v'#13'Hex: %hex' HintFormat = 'H: %h S: %s V: %v'#13'Hex: %hex'
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 0 TabOrder = 0
@ -602,8 +603,8 @@ object Form1: TForm1
OnChange = HSVColorPicker1Change OnChange = HSVColorPicker1Change
end end
object VColorPicker2: TVColorPicker object VColorPicker2: TVColorPicker
Left = 360 Left = 364
Height = 302 Height = 355
Top = 2 Top = 2
Width = 22 Width = 22
HintFormat = 'Value: %v (selected)' HintFormat = 'Value: %v (selected)'
@ -617,14 +618,14 @@ object Form1: TForm1
end end
object TabSheet6: TTabSheet object TabSheet6: TTabSheet
Caption = 'SLHColorPicker' Caption = 'SLHColorPicker'
ClientHeight = 329 ClientHeight = 356
ClientWidth = 387 ClientWidth = 395
ImageIndex = 5 ImageIndex = 5
object SLHColorPicker1: TSLHColorPicker object SLHColorPicker1: TSLHColorPicker
Left = 8 Left = 8
Height = 317 Height = 344
Top = 6 Top = 6
Width = 377 Width = 385
HPickerHintFormat = 'Hue: %h (selected)' HPickerHintFormat = 'Hue: %h (selected)'
SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex' SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex'
ParentShowHint = False ParentShowHint = False
@ -636,12 +637,12 @@ object Form1: TForm1
end end
object TabSheet11: TTabSheet object TabSheet11: TTabSheet
Caption = 'Lists && Trees' Caption = 'Lists && Trees'
ClientHeight = 335 ClientHeight = 356
ClientWidth = 395 ClientWidth = 395
ImageIndex = 10 ImageIndex = 10
object mbColorList1: TmbColorList object mbColorList1: TmbColorList
Left = 200 Left = 200
Height = 278 Height = 299
Top = 10 Top = 10
Width = 183 Width = 183
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
@ -649,7 +650,7 @@ object Form1: TForm1
end end
object mbColorTree1: TmbColorTree object mbColorTree1: TmbColorTree
Left = 8 Left = 8
Height = 279 Height = 300
Top = 10 Top = 10
Width = 184 Width = 184
InfoLabelText = 'Color Values:' InfoLabelText = 'Color Values:'
@ -662,7 +663,7 @@ object Form1: TForm1
object Button5: TButton object Button5: TButton
Left = 128 Left = 128
Height = 25 Height = 25
Top = 296 Top = 317
Width = 137 Width = 137
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Add colors from palette' Caption = 'Add colors from palette'
@ -672,7 +673,7 @@ object Form1: TForm1
end end
object TabSheet7: TTabSheet object TabSheet7: TTabSheet
Caption = 'More' Caption = 'More'
ClientHeight = 335 ClientHeight = 356
ClientWidth = 395 ClientWidth = 395
ImageIndex = 6 ImageIndex = 6
object Label9: TLabel object Label9: TLabel
@ -694,19 +695,19 @@ object Form1: TForm1
ScreenHintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h' ScreenHintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
ShowScreenHint = True ShowScreenHint = True
end end
object Button3: TButton object OfficeColorDialogButton: TButton
Left = 8 Left = 8
Height = 25 Height = 25
Top = 40 Top = 40
Width = 104 Width = 104
Caption = 'OfficeColorDialog' Caption = 'OfficeColorDialog'
OnClick = Button3Click OnClick = OfficeColorDialogButtonClick
TabOrder = 1 TabOrder = 1
end end
object LColorPicker1: TLColorPicker object LColorPicker1: TLColorPicker
Left = 34 Left = 34
Height = 25 Height = 25
Top = 224 Top = 245
Width = 347 Width = 347
HintFormat = 'Luminance: %l (selected)' HintFormat = 'Luminance: %l (selected)'
SelectionIndicator = siRect SelectionIndicator = siRect
@ -719,7 +720,7 @@ object Form1: TForm1
object VColorPicker1: TVColorPicker object VColorPicker1: TVColorPicker
Left = 34 Left = 34
Height = 21 Height = 21
Top = 192 Top = 213
Width = 347 Width = 347
HintFormat = 'Value: %v (selected)' HintFormat = 'Value: %v (selected)'
ArrowPlacement = spBefore ArrowPlacement = spBefore
@ -735,7 +736,7 @@ object Form1: TForm1
object HColorPicker1: THColorPicker object HColorPicker1: THColorPicker
Left = 34 Left = 34
Height = 61 Height = 61
Top = 263 Top = 284
Width = 347 Width = 347
HintFormat = 'Hue: %h (selected)' HintFormat = 'Hue: %h (selected)'
Increment = 5 Increment = 5
@ -748,7 +749,7 @@ object Form1: TForm1
end end
object SColorPicker1: TSColorPicker object SColorPicker1: TSColorPicker
Left = 8 Left = 8
Height = 254 Height = 275
Top = 70 Top = 70
Width = 19 Width = 19
HintFormat = 'Saturation: %s (selected)' HintFormat = 'Saturation: %s (selected)'
@ -764,7 +765,7 @@ object Form1: TForm1
end end
object Memo1: TMemo object Memo1: TMemo
Left = 128 Left = 128
Height = 150 Height = 171
Top = 26 Top = 26
Width = 253 Width = 253
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -811,7 +812,7 @@ object Form1: TForm1
end end
object TabSheet8: TTabSheet object TabSheet8: TTabSheet
Caption = 'Other' Caption = 'Other'
ClientHeight = 335 ClientHeight = 356
ClientWidth = 395 ClientWidth = 395
ImageIndex = 7 ImageIndex = 7
object HSColorPicker1: THSColorPicker object HSColorPicker1: THSColorPicker
@ -851,8 +852,8 @@ object Form1: TForm1
end end
object TabSheet9: TTabSheet object TabSheet9: TTabSheet
Caption = 'Even more' Caption = 'Even more'
ClientHeight = 292 ClientHeight = 356
ClientWidth = 372 ClientWidth = 395
ImageIndex = 8 ImageIndex = 8
object Label8: TLabel object Label8: TLabel
Left = 6 Left = 6
@ -997,8 +998,8 @@ object Form1: TForm1
end end
object TabSheet10: TTabSheet object TabSheet10: TTabSheet
Caption = 'Yet even more' Caption = 'Yet even more'
ClientHeight = 303 ClientHeight = 356
ClientWidth = 391 ClientWidth = 395
ImageIndex = 9 ImageIndex = 9
object RAxisColorPicker1: TRAxisColorPicker object RAxisColorPicker1: TRAxisColorPicker
Left = 10 Left = 10
@ -1186,6 +1187,17 @@ object Form1: TForm1
State = cbChecked State = cbChecked
TabOrder = 7 TabOrder = 7
end end
object CbEnabled: TCheckBox
Left = 416
Height = 19
Top = 371
Width = 62
Caption = 'Enabled'
Checked = True
OnChange = CbEnabledChange
State = cbChecked
TabOrder = 8
end
object mbOfficeColorDialog1: TmbOfficeColorDialog object mbOfficeColorDialog1: TmbOfficeColorDialog
UseHints = True UseHints = True
left = 456 left = 456

View File

@ -21,6 +21,7 @@ type
TForm1 = class(TForm) TForm1 = class(TForm)
CbShowHints: TCheckBox; CbShowHints: TCheckBox;
CbEnabled: TCheckBox;
Label10: TLabel; Label10: TLabel;
Label11: TLabel; Label11: TLabel;
Label12: TLabel; Label12: TLabel;
@ -52,7 +53,7 @@ type
TabSheet8: TTabSheet; TabSheet8: TTabSheet;
mbDeskPickerButton1: TmbDeskPickerButton; mbDeskPickerButton1: TmbDeskPickerButton;
mbOfficeColorDialog1: TmbOfficeColorDialog; mbOfficeColorDialog1: TmbOfficeColorDialog;
Button3: TButton; OfficeColorDialogButton: TButton;
LColorPicker1: TLColorPicker; LColorPicker1: TLColorPicker;
VColorPicker1: TVColorPicker; VColorPicker1: TVColorPicker;
HColorPicker1: THColorPicker; HColorPicker1: THColorPicker;
@ -104,7 +105,9 @@ type
Memo1: TMemo; Memo1: TMemo;
Label9: TLabel; Label9: TLabel;
CbSwatchStyle: TCheckBox; CbSwatchStyle: TCheckBox;
procedure CbEnabledChange(Sender: TObject);
procedure CbShowHintsChange(Sender: TObject); procedure CbShowHintsChange(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
procedure PageControl1MouseMove(Sender: TObject; Shift: TShiftState; procedure PageControl1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer); X, Y: Integer);
procedure tb1Change(Sender: TObject); procedure tb1Change(Sender: TObject);
@ -130,7 +133,7 @@ type
procedure SLHColorPicker1MouseMove(Sender: TObject; Shift: TShiftState; procedure SLHColorPicker1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer); X, Y: Integer);
procedure mbDeskPickerButton1SelColorChange(Sender: TObject); procedure mbDeskPickerButton1SelColorChange(Sender: TObject);
procedure Button3Click(Sender: TObject); procedure OfficeColorDialogButtonClick(Sender: TObject);
procedure HSColorPicker1Change(Sender: TObject); procedure HSColorPicker1Change(Sender: TObject);
procedure HSColorPicker1MouseMove(Sender: TObject; Shift: TShiftState; procedure HSColorPicker1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer); X, Y: Integer);
@ -265,13 +268,18 @@ sc.color := mbDeskPickerButton1.SelectedColor;
uc.color := mbDeskPickerButton1.SelectedColor; uc.color := mbDeskPickerButton1.SelectedColor;
end; end;
procedure TForm1.PageControl1Change(Sender: TObject);
begin
CbEnabledChange(nil);
end;
procedure TForm1.PageControl1MouseMove(Sender: TObject; Shift: TShiftState; procedure TForm1.PageControl1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer); X, Y: Integer);
begin begin
uc.color := HSLColorpicker1.ColorUnderCursor; uc.color := HSLColorpicker1.ColorUnderCursor;
end; end;
procedure TForm1.Button3Click(Sender: TObject); procedure TForm1.OfficeColorDialogButtonClick(Sender: TObject);
begin begin
if mbOfficeColorDialog1.Execute then if mbOfficeColorDialog1.Execute then
sc.color := mbOfficeColorDialog1.SelectedColor; sc.color := mbOfficeColorDialog1.SelectedColor;
@ -398,6 +406,65 @@ begin
mbcolorlist1.UpdateColors; mbcolorlist1.UpdateColors;
end; end;
procedure TForm1.CbEnabledChange(Sender: TObject);
begin
if PageControl1.ActivePage = Tabsheet1 then
HSLColorPicker1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet2 then
HexaColorPicker1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet3 then
mbColorPalette1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet4 then
HSLRingPicker1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet5 then
HSVColorPicker1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet6 then
SLHColorPicker1.Enabled := CbEnabled.Checked
else if PageControl1.ActivePage = Tabsheet11 then
begin
mbColorList1.Enabled := CbEnabled.Checked;
mbColorTree1.Enabled := CbEnabled.Checked;
end
else if PageControl1.ActivePage = Tabsheet7 then
begin
mbDeskPickerButton1.Enabled := CbEnabled.Checked;
OfficeColorDialogButton.Enabled := CbEnabled.Checked;
LColorPicker1.Enabled := CbEnabled.Checked;
VColorPicker1.Enabled := CbEnabled.Checked;
HColorPicker1.Enabled := CbEnabled.Checked;
SColorPicker1.Enabled := CbEnabled.Checked;
end
else if PageControl1.ActivePage = Tabsheet8 then
begin
HSColorPicker1.Enabled := CbEnabled.Checked;
SLColorPicker1.Enabled := CbEnabled.Checked;
HRingPicker1.Enabled := CbEnabled.Checked;
end
else if PageControl1.ActivePage = Tabsheet9 then
begin
CColorPicker1.Enabled := CbEnabled.Checked;
MColorPicker1.Enabled := CbEnabled.Checked;
YColorPicker1.Enabled := CbEnabled.Checked;
KColorPicker1.Enabled := CbEnabled.Checked;
RColorPicker1.Enabled := CbEnabled.Checked;
BColorPicker1.Enabled := CbEnabled.Checked;
GColorPicker1.Enabled := CbEnabled.Checked;
KColorPicker2.Enabled := CbEnabled.Checked;
MColorPicker2.Enabled := CbEnabled.Checked;
CColorPicker2.Enabled := CbEnabled.Checked;
YColorPicker2.Enabled := CbEnabled.Checked;
end
else if PageControl1.ActivePage = Tabsheet10 then
begin
RAxisColorPicker1.Enabled := CbEnabled.Checked;
GAxisColorPicker1.Enabled := CbEnabled.Checked;
BAxisColorPicker1.Enabled := CbEnabled.Checked;
CIELColorPicker1.Enabled := CbEnabled.Checked;
CIEAColorPicker1.Enabled := CbEnabled.Checked;
CIEBColorPicker1.Enabled := CbEnabled.Checked;
end;
end;
procedure TForm1.CbSwatchStyleClick(Sender: TObject); procedure TForm1.CbSwatchStyleClick(Sender: TObject);
begin begin
sc.swatchstyle := CbSwatchStyle.Checked; sc.swatchstyle := CbSwatchStyle.Checked;

View File

@ -74,28 +74,29 @@ type
procedure DrawCell(ACanvas: TCanvas; AColor: string); procedure DrawCell(ACanvas: TCanvas; AColor: string);
procedure DrawCellBack(ACanvas: TCanvas; R: TRect; AIndex: integer); procedure DrawCellBack(ACanvas: TCanvas; R: TRect; AIndex: integer);
procedure ColorsChange(Sender: TObject); procedure ColorsChange(Sender: TObject);
procedure Click; override;
procedure Resize; override; procedure Resize; override;
procedure SelectCell(i: integer); procedure SelectCell(i: integer);
// procedure CreateWnd; override; // procedure CreateWnd; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseEnter; override;
procedure MouseLeave; override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
{$IFDEF DELPHI} {$IFDEF DELPHI}
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; // procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; // procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN; procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN;
procedure CMGotFocus(var Message: TCMGotFocus); message CM_ENTER; procedure CMGotFocus(var Message: TCMGotFocus); message CM_ENTER;
procedure CMLostFocus(var Message: TCMLostFocus); message CM_EXIT; procedure CMLostFocus(var Message: TCMLostFocus); message CM_EXIT;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; // procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW; procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
{$ELSE} {$ELSE}
procedure CMMouseEnter(var Message: TLMessage); message CM_MOUSEENTER; // procedure CMMouseEnter(var Message: TLMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE; // procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE;
procedure CNKeyDown(var Message: TLMKeyDown); message CN_KEYDOWN; procedure CNKeyDown(var Message: TLMKeyDown); message CN_KEYDOWN;
procedure CMGotFocus(var Message: TLMessage); message CM_ENTER; procedure CMGotFocus(var Message: TLMessage); message CM_ENTER;
procedure CMLostFocus(var Message: TLMessage); message CM_EXIT; procedure CMLostFocus(var Message: TLMessage); message CM_EXIT;
procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED; // procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW; procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW;
{$ENDIF} {$ENDIF}
@ -689,10 +690,10 @@ end;
procedure TmbColorPalette.Resize; procedure TmbColorPalette.Resize;
begin begin
inherited; inherited;
CalcAutoHeight; // wp: will cause a ChangedBounds endless loop CalcAutoHeight;
Invalidate; Invalidate;
end; end;
(*
procedure TmbColorPalette.CMMouseEnter( procedure TmbColorPalette.CMMouseEnter(
var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} ); var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} );
begin begin
@ -711,6 +712,24 @@ begin
Invalidate; Invalidate;
inherited; inherited;
end; end;
*)
procedure TmbColorPalette.MouseEnter;
begin
FMouseOver := true;
FMouseLoc := mlOver;
Invalidate;
inherited;
end;
procedure TmbColorPalette.MouseLeave;
begin
FMouseOver := false;
FMouseLoc := mlNone;
FIndex := -1;
Invalidate;
inherited;
end;
procedure TmbColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer); procedure TmbColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer);
var var
@ -744,11 +763,6 @@ begin
inherited; inherited;
end; end;
procedure TmbColorPalette.Click;
begin
inherited;
end;
procedure TmbColorPalette.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure TmbColorPalette.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var var
DontCheck: boolean; DontCheck: boolean;
@ -790,14 +804,14 @@ begin
FMouseLoc := mlNone; FMouseLoc := mlNone;
Invalidate; Invalidate;
end; end;
(*
procedure TmbColorPalette.CMEnabledChanged( procedure TmbColorPalette.CMEnabledChanged(
var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} ); var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} );
begin begin
inherited; inherited;
Invalidate; Invalidate;
end; end;
*)
procedure TmbColorPalette.SelectCell(i: integer); procedure TmbColorPalette.SelectCell(i: integer);
begin begin
if i < FColors.Count - 1 then if i < FColors.Count - 1 then