![]() |
MKI_DialogHandleSlider (Dialogs) Changed in Version 2025.0 |
www.CAD6.com |
C++ Syntaxbool MKI_DialogHandleSlider( HWND f_hWindow, WPARAM f_wParam, LPARAM f_lParam, __int32 f_nCtlID, __int32 f_nMin, __int32 f_nMax, __int32 f_nStep, __int32& f_rValue );
This procedure handles all messages belonging to a horizontal slider control.
Windows 11 no longer supports scrollbars in a decent way (as the arrows are hidden unless hovered above) and official spin controls cannot be unlimited or use double values. So we replaced most scrollbars in dialog windows with sliders or custom spin controls made out of a '+' and a '–' button. We encourage you to use those replacements, too.
Parametersf_hWindow [HWND] Handle of the dialog window that contains the slider control. f_wParam [WPARAM] The value of the wParam parameter passed to the window's callback procedure. f_lParam [LPARAM] The value of the lParam parameter passed to the window's callback procedure. f_nCtlID [__int32] Identification number of the slider control whose messages shall be handled. f_nMin [__int32] Minimum value assigned to the left end of the slider. f_nMax [__int32] Maximum value assigned to the right end of the slider. f_nStep New in Version 2023.0 [__int32] Step by which the current value shall be changed by means of the slider if "one page up / down" is used. Any value smaller than 1 will be set to 1. f_rValue Changed in Version 2025.0 [__int32&] Reference of a value that receives the slider control's position (only if true is returned). The initial value will be used for relative movement such as "one line up / down" oder "one page up / down". If its initial value is MKI_INT32_NOVAL, the current position will be handled using default system increments / decrements (ignoring f_nStep).
Return ValueReturns true if the slider control's position was changed (and returns the position in f_rValue), else false.
CommentThis procedure should be called in the WM_HSCROLL case of the dialog's window procedure:
INT_PTR CALLBACK DialogProc( HWND f_hDlg, UINT f_unMessage, WPARAM f_wParam, LPARAM f_lParam ) { static __int32 nValue;
switch( f_unMessage ) { case WM_HSCROLL: ...
if( MKI_DialogHandleSlider( f_hDlg, f_wParam, f_lParam, IDD_SCROLL0, -100, 100, 5, nValue ) ) { SetDlgItemInt( f_hDlg, IDD_EDIT0, nValue, true ); return( true ); }
... break; } return( false ); }
|
CAD6interface 2025.0 - Copyright 2025 Malz++Kassner® GmbH