Solved

UpDownControl settings?

Posted on 1998-10-16
4
203 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 Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

831 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