noobofthenoobs
Cryogen2003
Цитата:
У TcxCheckComboBoxProperties своство AllowGrayed помечено как deprecated, так что его уcтавка не может решить проблему noobofthenoobs.
Как вариант решения можно предложить испольование связки cxPopupEdit и cxCheckListBox.
Важно, свойство EditValueFormat должно быть установлено в значение отличное от cvfInteger и, соответственно, как упоминалось ранее, AllowGrayed = True.
[more=Например]
*.dfm
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 390
ClientWidth = 339
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object cxCheckComboBox1: TcxCheckComboBox
Left = 104
Top = 56
Properties.Items = <
item
Description = 'Item1'
end
item
Description = 'Item2'
end
item
Description = 'Item3'
end>
TabOrder = 0
Width = 121
end
object Button1: TButton
Left = 120
Top = 96
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object cxCheckListBox1: TcxCheckListBox
Left = 8
Top = 285
Width = 121
Height = 97
AllowGrayed = True
EditValueFormat = cvfIndices
Items = <
item
Text = 'Item1'
end
item
Text = 'Item2'
end
item
Text = 'Item3'
end>
TabOrder = 3
Visible = False
OnCheckStatesToEditValue = cxCheckListBox1CheckStatesToEditValue
OnClickCheck = cxCheckListBox1ClickCheck
end
object cxPopupEdit1: TcxPopupEdit
Left = 104
Top = 144
Properties.PopupClientEdge = True
Properties.PopupControl = cxCheckListBox1
Properties.PopupSizeable = False
Properties.ReadOnly = False
Properties.OnCloseUp = cxPopupEdit1PropertiesCloseUp
Properties.OnInitPopup = cxPopupEdit1PropertiesInitPopup
TabOrder = 2
Text = 'None selected'
Width = 121
end
end
-----------------
*.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCheckComboBox,
StdCtrls, dxSkinsCore, cxCheckListBox, cxCheckBox;
type
TForm1 = class(TForm)
cxCheckComboBox1: TcxCheckComboBox;
Button1: TButton;
cxCheckListBox1: TcxCheckListBox;
cxPopupEdit1: TcxPopupEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure cxCheckListBox1CheckStatesToEditValue(Sender: TObject; const ACheckStates: TcxCheckStates; out AEditValue:
Variant);
procedure cxCheckListBox1ClickCheck(Sender: TObject; AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
procedure cxPopupEdit1PropertiesInitPopup(Sender: TObject);
procedure cxPopupEdit1PropertiesCloseUp(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
cxcheckcombobox1.States[1]:=cbsGrayed;
end;
procedure TForm1.cxCheckListBox1CheckStatesToEditValue(Sender: TObject; const ACheckStates: TcxCheckStates; out
AEditValue: Variant);
begin
//ваш код для более наглядного отображения cxPopupEdit1.Text
end;
procedure TForm1.cxCheckListBox1ClickCheck(Sender: TObject; AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
begin
cxPopupEdit1.Text := VarToStr(cxCheckListBox1.EditValue);
end;
procedure TForm1.cxPopupEdit1PropertiesCloseUp(Sender: TObject);
begin
cxCheckListBox1.Visible := False;
end;
procedure TForm1.cxPopupEdit1PropertiesInitPopup(Sender: TObject);
begin
cxCheckListBox1.Visible := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
cxcheckcombobox1.Properties.AllowGrayed:=true;
end;
end.
[/more]
Cryogen2003
Цитата:
Дык разрешить надо, чтобы был вариант с Grayed - AllowGrayed..... и будет тебе счастья
У TcxCheckComboBoxProperties своство AllowGrayed помечено как deprecated, так что его уcтавка не может решить проблему noobofthenoobs.
Как вариант решения можно предложить испольование связки cxPopupEdit и cxCheckListBox.
Важно, свойство EditValueFormat должно быть установлено в значение отличное от cvfInteger и, соответственно, как упоминалось ранее, AllowGrayed = True.
[more=Например]
*.dfm
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 390
ClientWidth = 339
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object cxCheckComboBox1: TcxCheckComboBox
Left = 104
Top = 56
Properties.Items = <
item
Description = 'Item1'
end
item
Description = 'Item2'
end
item
Description = 'Item3'
end>
TabOrder = 0
Width = 121
end
object Button1: TButton
Left = 120
Top = 96
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object cxCheckListBox1: TcxCheckListBox
Left = 8
Top = 285
Width = 121
Height = 97
AllowGrayed = True
EditValueFormat = cvfIndices
Items = <
item
Text = 'Item1'
end
item
Text = 'Item2'
end
item
Text = 'Item3'
end>
TabOrder = 3
Visible = False
OnCheckStatesToEditValue = cxCheckListBox1CheckStatesToEditValue
OnClickCheck = cxCheckListBox1ClickCheck
end
object cxPopupEdit1: TcxPopupEdit
Left = 104
Top = 144
Properties.PopupClientEdge = True
Properties.PopupControl = cxCheckListBox1
Properties.PopupSizeable = False
Properties.ReadOnly = False
Properties.OnCloseUp = cxPopupEdit1PropertiesCloseUp
Properties.OnInitPopup = cxPopupEdit1PropertiesInitPopup
TabOrder = 2
Text = 'None selected'
Width = 121
end
end
-----------------
*.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCheckComboBox,
StdCtrls, dxSkinsCore, cxCheckListBox, cxCheckBox;
type
TForm1 = class(TForm)
cxCheckComboBox1: TcxCheckComboBox;
Button1: TButton;
cxCheckListBox1: TcxCheckListBox;
cxPopupEdit1: TcxPopupEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure cxCheckListBox1CheckStatesToEditValue(Sender: TObject; const ACheckStates: TcxCheckStates; out AEditValue:
Variant);
procedure cxCheckListBox1ClickCheck(Sender: TObject; AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
procedure cxPopupEdit1PropertiesInitPopup(Sender: TObject);
procedure cxPopupEdit1PropertiesCloseUp(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
cxcheckcombobox1.States[1]:=cbsGrayed;
end;
procedure TForm1.cxCheckListBox1CheckStatesToEditValue(Sender: TObject; const ACheckStates: TcxCheckStates; out
AEditValue: Variant);
begin
//ваш код для более наглядного отображения cxPopupEdit1.Text
end;
procedure TForm1.cxCheckListBox1ClickCheck(Sender: TObject; AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
begin
cxPopupEdit1.Text := VarToStr(cxCheckListBox1.EditValue);
end;
procedure TForm1.cxPopupEdit1PropertiesCloseUp(Sender: TObject);
begin
cxCheckListBox1.Visible := False;
end;
procedure TForm1.cxPopupEdit1PropertiesInitPopup(Sender: TObject);
begin
cxCheckListBox1.Visible := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
cxcheckcombobox1.Properties.AllowGrayed:=true;
end;
end.
[/more]