Solved

UpDownControl settings?

Posted on 1998-10-16
4
204 Views
Last Modified: 2013-12-03
How do i set the stepsize and position in an UpDownControl?
I don´t want to wait until i get a WM_NOTIFY.
0
Comment
Question by:AndersCarlsson
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
snoegler earned 100 total points
ID: 1415328
Usually you do this in the handler for WM_INITDIALOG. At this point ( after calling the default
window procedure) all dialog items are valid, so you can set/change anything you want.
If you are using MFC, then put your initialization in the OnInitDialog() handler.
SDK Example:

LRESULT MyDlgProc(...)
{
  ...
  switch(message) {
    case WM_INITDIALOG:
      DefWindowProc(hWnd,message,wParam,lParam);
      // do initialization
      return TRUE;
    ...
   }
   ...
}

MFC example:

BOOL MyDlg::OnInitDialog()
{
  // ClassWizard generated stuff
  ...
  // do initialization here
  return TRUE;
}
0
 

Author Comment

by:AndersCarlsson
ID: 1415329
I do´nt have my UpDownControl in a dialog box.
I use it in a "home made" control that can change a value by  the UD-control or by a graphic scale.
If i change the value by the graphic control and then clicks in the UpDown control it goes back to the previous value.
I can´t use the style UDS_SETBUDDYINT bacause the value is a decimal number (2 decimals), between 0.0 and 3.0.
The UD cntrl must have Max and Min values as int´s.
0
 

Author Comment

by:AndersCarlsson
ID: 1415330
Sorry I forgot
I don´t get any WM_INITDIALOG message to my customcontrol
:>
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1415331
I see. You'll then have to do it like this:

1. Create your control
2. Send the UDM_ messages (like UDM_SETRANGE to set the min/max values) to the control
(the HWND is valid after calling CreateWindow ( or CSpinButton::Create )).
3. On each change of the edit(EN_CHANGE)  field you want the spinbutton to be associated
with, set the spin buttons position according to the value you have (UDM_SETPOS).

If you are using values between 0.0 and 3.0, and want to adjust them using the spin button
with 3 digits precision, then simply multiply by 100 : UDM_SETRANGE(0,300) and
set the acceleration using UDM_SETACCEL.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio Debugging 3 151
Slow process to read Excel 15 145
Which Microsoft MSDN Package Is The One I need? 3 50
Best way to accomplish this task? 3 93
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question