Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the TUpDown control

Status
Not open for further replies.

Punchinello

Programmer
Apr 25, 2003
116
US
If you've ever used a TUpDown control with a TEdit field then you've probably noticed that the UpDown button aligns on the outside of the Edit border. Windows, on the other hand, generally shows the UpDown control on the inside of the Edit border, providing a look consistent with that of a combo box. Here's a quick-and-dirty way to do that with Delphi.

1. Place a TEdit and a TUpDown on a form.
2. Set the UpDown1.Associate property to Edit1.
(it will align itself to the outside of Edit1)
3. Place this code in the Form's OnShow event:
Code:
UpDown1.SetBounds(Edit1.Left + 
                    Edit1.Width - 
                    GetSystemMetrics(SM_CXEDGE) - 
                    GetSystemMetrics(SM_CXVSCROLL),
                  Edit1.Top + 
                    GetSystemMetrics(SM_CYEDGE),
                  GetSystemMetrics(SM_CXVSCROLL),
                  Edit1.ClientHeight);
4. Run the project. [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top