Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

UpDownControl settings?

Posted on 1998-10-16
4
Medium Priority
?
210 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 400 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

916 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