Solved

UpDownControl settings?

Posted on 1998-10-16
4
199 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now