| Header file: | updown.h |
| Object name: | fUPDOWN |
| Object index: | 1 of 1 Object |
You may have seen in many edit controls with little buttons on the right hand side, which, when clicked, increase or decrease the value in the edit control. They quite often look like that which is shown on the left.
Well, now you can have one too. That's what this class is - and you can add one of these things to lots of other controls, too.
This component is derived from _GUIBASE, and inherits the properties from that.
A 'buddy' window is a window that the updown control works with - ie. an edit control that the updown changes the value of.
| Name | Description | Value |
| Name | Description | Value |
| udUsual | This style just creates the updown control, and does nothing with it. You will need this style as well as some other styles to make the control do something. | AvWind |
| The following options are a little different. Whereas the above options are a mixture of styles to create one type of object, the following styles are by themselves. You can mix them up to make more customised objects. You mix the styles with the OR (|) operator. You can even mix them with the above styles to enhance them further. Mix and match away! | ||
|
udAlignLeft udAlignRight | These styles align the updown control on a certain side of the buddy control. By default, this is the right hand side, but feel free to change it. |
UDS_ALIGNLEFT UDS_ALIGNRIGHT |
| udSetIntegerAuto | This style allows the updown control to set the buddy controls values as integers. This is the default action, but you should include this style anyway. | UDS_SETBUDDYINT |
| udNoThousandsSeperator | This style stops the updown control from adding ',' between every thousand group in the buddy control. | UDS_NOTHOUSANDS |
| udEnableKeyboardInput | This style allows the updown control to intercept the up and down cursor keys, and use them to increment or decrement the values in the buddy control. | UDS_ARROWKEYS |
| udHorizontal | This style allows the updown control to have horizontally oriented buttons, instead of the usual vertically oriented buttons. | UDS_HORZ |
| udWrap | This is an interesting style. When the updown control reaches its set maximum, it will stop. However, with this style, the control will wrap around to the bottom or top again, as applicable. | UDS_WRAP |
| Prototype | Description |
|
void Attach(HWND Buddy); void Attach(void* Buddy); | These functions attach the updown control to a buddy window. The first function takes a handle to a window. The second function takes a void pointer to a _GUIBASE object. If you are not sure on how to use the second function, just see the example at the end of this page. |
| void SetBase(int Base); | The updown control doesn't just know base-10 counting systems. By passing 16 to this function, the updown will count in Hexadecimal. To reset it back to normal, just pass 10. |
| int GetBase(void); | This function returns the current counting base that the updown control is using. The number returned will be either 10 or 16. |
| void SetRange(int Min, int Max); | This function sets the range of the updown control. The updown will then stay within this range. |
|
int GetLowerRange(void); int GetUpperRange(void); | These functions return the lower and upper range of the updown control, respectively. |
| void SetIncrement(int Increment, int Time); | This function sets the increment - the amount that the number increases each time an up or down button is clicked. |
| void SetPosition(int Position); | This function sets the current number in the control. |
| int GetPosition(void); | This funcion returns the current number in the control. |
Please note that the events listed here are done in pairs; one as a property, and the other as a function. The property is assigned a function name, ie. Object.OnClick = &FunctionName, whilst the function is called to verify that an event has occured. Please see the chapter on event handling for information on how to use these correctly.
| Prototype | Description | Sent under |
|
bool CheckVerticalScroll(wParam, lParam); void (*OnVerticalScroll)(fUPDOWN* Sender, int Action, int Position); |
This event occurs when the updown is vertically scrolled. Action is one of the following values (taken from the Win32 SDK Reference manual):
| WM_COMMAND |
|
bool CheckHorizontalScroll(wParam, lParam); void (*OnHorizontalScroll)(fUPDOWN* Sender, int Action, int Position); |
This event occurs when the updown is horizontally scrolled. Action is one of the following values (taken from the Win32 SDK Reference manual):
| WM_COMMAND |
The following snippet gives a basic idea of how to use this component.
//Create a updown, and an edit to go with it.
fEDIT Edit;
fUPDOWN Updown;
Edit.CreateWin(Window.GetHandle(), "10", EDIT_ID, txNormal, txUsual);
Updown.CreateWin(Window.GetHandle(), "", UPDOWN_ID, udNormal,
udUsual | udSetIntegerAuto);
//Now tie them together...
Updown.Attach(Edit.GetHandle());
// ... or ...
Updown.Attach((void*)&Edit);
//Simple as that!
| Back to index | The FreeFoote Foundation Classes Documentation |