Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 23040, How to make the DevExpress calculator edit always show the calcu

by Dave Nottage Email: Anonymous


How to make the DevExpress calculator edit always show the calculator
Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 7.0  to 7.0 0 downloads
Copyright: No significant restrictions


Size: 0 bytes
Updated on Wed, 16 Feb 2005 19:28:21 GMT
Originally uploaded on Wed, 16 Feb 2005 19:34:10 GMT
Description
Start a new project, drop a cxCalcEdit control onto the form. Make the width of the cxCalcEdit 200 pixels wide.

I also like to set the Properties.Alignment.Horz property to taRightJustify and Properties.UseLeftAlignmentOnEditing to False. Makes it look more like a calculator :-)

Now refer to the following code of the form's unit:

type
// Redeclare the calculator class to access protected members
TcxPopupCalculator = class(cxCalc.TcxPopupCalculator);

// Redeclare the calculator edit class to override the CanDropDown method
TcxCalcEdit = class(cxCalc.TcxCalcEdit)
protected
function CanDropDown: Boolean; override;
end;

TForm1 = class(TForm)
cxCalcEdit: TcxCalcEdit;
procedure FormCreate(Sender: TObject);
private
FCalc: TcxPopupCalculator;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

{ TcxCalcEdit }

function TcxCalcEdit.CanDropDown: Boolean;
begin
// Prevent the calculator edit from dropping down as we're using our own
Result := False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
FCalc := TcxPopupCalculator.Create(Self);
// Align the calculator control
FCalc.Left := cxCalcEdit.Left;
FCalc.Top := cxCalcEdit.Top + cxCalcEdit.Height + 1;
// Assign the edit control to our calculator edit control
FCalc.Edit := cxCalcEdit;
FCalc.Parent := Self;
end;

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03