1 #include "ModuleControlLongSpin.h"
3 int CModuleControlLongSpin::GetHeightRequest() {
7 void CModuleControlLongSpin::Initialise(CDasherInterfaceBase
*pInterface
) {
8 int iValue(pInterface
->GetLongParameter(m_iId
));
9 SendMessage(m_hSpin
, UDM_SETPOS
, 0, (LPARAM
) MAKELONG ((short)iValue
, 0));
10 UpdateEntry(iValue
, 0);
13 void CModuleControlLongSpin::Apply(CDasherInterfaceBase
*pInterface
) {
14 int iValue(SendMessage(m_hSpin
, UDM_GETPOS
, 0, 0));
15 pInterface
->SetLongParameter(m_iId
, iValue
);
18 void CModuleControlLongSpin::CreateChild(HWND hParent
) {
19 m_hEntry
= CreateWindowEx(WS_EX_CONTROLPARENT
| WS_EX_CLIENTEDGE
, TEXT("EDIT"), NULL
,
20 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
, 0, 0, 0, 0, hParent
, NULL
, WinHelper::hInstApp
, NULL
);
23 hGuiFont
= GetStockObject(DEFAULT_GUI_FONT
);
25 SendMessage(m_hEntry
, WM_SETFONT
, (WPARAM
)hGuiFont
, (LPARAM
)true);
27 m_hSpin
= CreateWindowEx(WS_EX_CLIENTEDGE
, UPDOWN_CLASS
, TEXT(""),
28 UDS_ALIGNRIGHT
| WS_CHILD
| WS_TABSTOP
|WS_VISIBLE
| WS_GROUP
, 0, 0, 16, 16,
29 hParent
, NULL
, WinHelper::hInstApp
, NULL
);
31 SendMessage(m_hSpin
, UDM_SETRANGE
, 0, (LPARAM
) MAKELONG(m_iMax
, m_iMin
));
34 void CModuleControlLongSpin::LayoutChild(RECT
&sRect
) {
35 ::MoveWindow(m_hEntry
, sRect
.left
, sRect
.top
, sRect
.right
- sRect
.left
, sRect
.bottom
- sRect
.top
, TRUE
);
36 SendMessage(m_hSpin
, UDM_SETBUDDY
, (WPARAM
)m_hEntry
, 0);
39 LRESULT
CModuleControlLongSpin::OnNotify(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
) {
40 NMHDR
*pNotify((LPNMHDR
)lParam
);
42 switch(pNotify
->code
) {
44 UpdateEntry(((LPNMUPDOWN
) lParam
)->iPos
, ((LPNMUPDOWN
) lParam
)->iDelta
);
54 void CModuleControlLongSpin::UpdateEntry(int iValue
, int iDelta
) {
56 _sntprintf(tcBuffer
, 100, TEXT("%0.4f"), (iValue
+ iDelta
) / static_cast<double>(m_iDivisor
));
57 SendMessage(m_hEntry
, WM_SETTEXT
, 0, (LPARAM
) tcBuffer
);