Solved

UpDownControl settings?

Posted on 1998-10-16
4
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe 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
VS2015 compilation and missing DLLs 9 191
Need to create an object factory 2 52
Trouble with References... 5 67
Why use this lambda? 12 96
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…

738 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