Up-Down – Giavapps Windows API

 

 

api_updown_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates an up-down control.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

UDS_ALIGNLEFT Positions the up-down control next to the left edge of the buddy window. The buddy window is moved to the right, and its width is decreased to accommodate the width of the up-down control.

UDS_ALIGNRIGHT Positions the up-down control next to the right edge of the buddy window. The width of the buddy window is decreased to accommodate the width of the up-down control.

UDS_ARROWKEYS Causes the up-down control to increment and decrement the position when the UP ARROW and DOWN ARROW keys are pressed.

UDS_AUTOBUDDY Automatically selects the previous window in the z-order as the up-down control’s buddy window.

UDS_HORZ Causes the up-down control’s arrows to point left and right instead of up and down.

UDS_HOTTRACK Causes the control to exhibit "hot tracking" behavior. That is, it highlights the UP ARROW and DOWN ARROW on the control as the pointer passes over them. This style requires Microsoft Windows 98 or Windows 2000. If the system is running Windows 95 or Microsoft Windows NT 4.0, the flag is ignored.

UDS_NOTHOUSANDS Does not insert a thousands separator between every three decimal digits.

UDS_SETBUDDYINT Causes the up-down control to set the text of the buddy window when the position changes. The text consists of the position formatted as a decimal or hexadecimal string.

UDS_WRAP Causes the position to "wrap" if it is incremented or decremented beyond the ending or beginning of the range.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new up-down control.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_updown_set_buddy(UpDownHandle, BuddyHandle) Sets the buddy control for an up-down control.

UpDownHandle: it must be an UpDownHandle.
BuddyHandle: handle to the new buddy control (usually it is an EditHandle).

 

api_updown_get_buddy(UpDownHandle) Returns the BuddyHandle of an up-down control.

UpDownHandle: it must be an UpDownHandle.

 

api_updown_set_range(UpDownHandle, Minimum, Maximum) Sets the minimum and maximum range for the given up-down control.

UpDownHandle: it must be an UpDownHandle.
Minimum: lower limit for the up-down control.
Maximum: upper limit for the up-down control.

 

api_updown_get_range(UpDownHandle, MinimumOrMaximum) Returns the minimum or maximum range of the given up-down control.

UpDownHandle: it must be an UpDownHandle.
MinimumOrMaximum: returns the minimum (false) or maximum (true) value.

 

api_updown_set_position(UpDownHandle, Position) Sets the current position for an up-down control.

UpDownHandle: it must be an UpDownHandle.
Position: new position for the up-down control. If the parameter is outside the control’s specified range, Position will be set to the nearest valid value.

 

api_updown_get_position(UpDownHandle) Returns the current position for an up-down control.

UpDownHandle: it must be an UpDownHandle.

 

api_updown_add_acceleration(Seconds, Increment) Adds a new acceleration to the dynamic array of accelerations.

Seconds: amount of elapsed time, in seconds, before the position change increment specified by Increment is used.
Increment: position change increment to use after the time specified by Seconds elapses.

 

api_updown_reset_acceleration() Clears all accelerations stored into the dynamic array of accelerations.

 

api_updown_set_acceleration(UpDownHandle) Sets the accelerations added with api_updown_add_acceleration() function to the given up-down control.

UpDownHandle: it must be an UpDownHandle.

 

api_updown_set_base(UpDownHandle, DecimalOrHexadecimal) Sets the radix base for an up-down control. The base value determines whether the buddy control displays numbers in decimal or hexadecimal digits. Hexadecimal numbers are always unsigned, and decimal numbers are signed.

UpDownHandle: it must be an UpDownHandle.
DecimalOrHexadecimal: sets decimal (false) or hexadecimal (true) radix base.

 

api_updown_get_base(UpDownHandle) Retrieves the current radix base for an up-down control. This function returns false for decimal radix base or true for hexadecimal radix base.

UpDownHandle: it must be an UpDownHandle.

 

Code Examples

 

Creating an Up-Down Control

 

updown = api_updown_create(window,10,10,32,32,WS_VISIBLE | WS_CHILD | UDS_ALIGNLEFT | UDS_SETBUDDYINT,0);

 

Setting a Buddy Control

 

api_updown_set_buddy(updown,edit);

 

Setting Range and Position

 

api_updown_set_range(updown,0,500);
api_updown_set_position(updown,250);

 

Setting Custom Accelerations

 

api_updown_add_acceleration(1,1);
api_updown_add_acceleration(2,5);
api_updown_add_acceleration(3,10);
api_updown_set_acceleration(updown);
api_updown_reset_acceleration();

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*