CspinbuttonctrlCommon attributes
CspinbuttonctrlCommon class member functions
CspinbuttonctrlSample Code
I,CspinbuttonctrlControl Properties
1. Add the Edit Control.
2. Add the spin control
If this is not the order, use Ctrl + D to change the tab order so that spin is close to the end of edit.
3. Set the group attribute on the Edit Control (note)
4. Set spinAttribute
If Auto Buddy is // true, a partner window is automatically associated in Z order.
Set buddy integer // true indicates that the value is displayed in the partner window.
Alignment is right align // indicates that the spin control is right aligned in the partner window
Orientation // horizontal or vertical
Wrap // when the value exceeds the range, the cycle is when the number of cycles exceeds the range.
Arrow Keys // true (the control can be increased or decreased when the up and down arrow keys are pressed)
II,CspinbuttonctrlCommon class member functions
Setaccel |
Set an acceleration value for the spin button. |
Getaccel |
Retrieves acceleration information for a spin button control. |
Setbase |
This member function is used to set the base number of a rotate button control. The base value determines whether the number displayed in the partner window is in decimal or hexadecimal format. The hexadecimal number is always unsigned; the decimal number is signed. |
Getbase |
Retrieves the current base for a spin button control. |
Setbuddy |
Set a partner window for the spin button. When you click the spin button, the focus will be on this partner window. |
Getbuddy |
Retrieves a pointer to the current buddy window. |
Setpos |
Set a current position for the spin control. |
Getpos |
Retrieves the current position of a spin button control. |
Setrange |
Set the range value. |
Getrange |
Retrieves the upper and lower limits (range) for a spin button control. |
Setrange32 |
Set the 32-bit range value |
Getrange32 |
Retrieves the 32-bit range for a spin button control. |
III,Sample Code
// Cdialog_spin_test Message Processing Program
Int cdialog_spin_test: oninitdialog (void)
{
Cdialog: oninitdialog ();
// Get object pointer
Cspinbuttonctrl * pspin = (cspinbuttonctrl *) getdlgitem (idc_spin1 );
Cedit * PEDT = (cedit *) getdlgitem (idc_edit2 );
Pspin-> setrange32 (); // set the range
Pspin-> setbase (10); // set the base number to be displayed in hexadecimal or hexadecimal notation.
Pspin-> setbuddy (PEDT); // set the partner window
Udaccel A [2]; //
A [0]. nsec = 1;
A [0]. ninc = 1;
A [1]. nsec = 3;
A [1]. ninc = 20;
Pspin-> setaccel (2, a); // sets the acceleration.
Return 0;
}