Y
ypluo
Unregistered / Unconfirmed
GUEST, unregistred user!
我在cxButtonedit里定义了三个事件nkeydown onPropertiesbuttonclick onPropertiesValidate,我想在buttonedit里输入'1234',然后回车,运行了validate和buttonclick事件,然后buttonedit显示'abcd'.可是老是不行,还是显示'1234',不知道为什么啊.unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxButtonEdit;type TForm1 = class(TForm) cxButtonEdit1: TcxButtonEdit; cxButtonEdit2: TcxButtonEdit; procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure cxButtonEdit1PropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure cxButtonEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.cxButtonEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);begin case key of VK_RETURN: begin key := 0; GetParentform(Self).perform(WM_NEXTDLGCTL,0,0); end; end;end;procedure TForm1.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);begin TcxButtonEdit(Sender).Text:='abcd';end;procedure TForm1.cxButtonEdit1PropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);var i,j:Integer;begin TcxButtonEdit(Sender).Properties.OnButtonClick(Sender,1);end;