Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
11 captures
25 Jan 2008 - 24 Oct 2012
AprJANMar
Previous capture05Next capture
200920122013
success
fail
COLLECTED BY
Organization:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
Collection:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20120105135921/http://www.codeproject.com:80/KB/edit/Numeric_edit_box.aspx
Click here to Skip to main content
8,385,919 members and growing!
EmailPassword Lost password?
Home
Search within:




Licence 
First Posted 11 Aug 2003
Views 48,628
Downloads 1,551
Bookmarked 21 times

Localized numeric editbox

ByNikolai Serdiuk | 11 Aug 2003
An article on extending edit box control
 
See Also
Print Article
add
Add to your CodeProject bookmarks
Discuss
Discuss this article
4
  4.00 (13 votes)
1 vote, 7.7%
1
1 vote, 7.7%
2
2 votes, 15.4%
3
5 votes, 38.5%
4
4 votes, 30.8%
5
4.00/5 - 13 votes
1 removed
μ 3.79, σa 2.16 [?]
Sponsored Links

NumericEdit

Introduction

Microsoft provides to developers rich collection of GUI controls. The edit box control is very useful, but has one diasadvantage: it does not supports the numeric decimals. This article describes the creation of numeric edit box.

Background

The Microsoft's controls are localized. For example, if you change the local time format from the "Regional Options" dialog,CDateTimeCtrlchange it time format. The presented numeric edit box is localized as well. By the creation time it loads the locale decimal point delimiter and use it. Here is the code:

////// Constructor.///CNumericEdit::CNumericEdit(){// determine the decimal delimiter buffer sizeconstint nBuffLen = ::GetLocaleInfo( LOCALE_USER_DEFAULT,         LOCALE_SDECIMAL, NULL,0 );    _ASSERT( nBuffLen>0 );// get the decimal number delimiterconstint nResult = ::GetLocaleInfo( LOCALE_USER_DEFAULT,         LOCALE_SDECIMAL,         m_strDelim.GetBuffer(nBuffLen), nBuffLen );    _ASSERT(nResult !=0);    m_strDelim.ReleaseBuffer();    }

Using the code

You should do following steps:

  1. Place the edit box control on the dialog.
  2. Assotiate theCEditdialog class member to the edit box control.
  3. Include the "NumericEdit.h" to the your dialog class header.
  4. Replace theCEditwithCNumericEdit.
    //// Example of using the code//#include"NumericEdit.h"// some codeprotected:// some code    CNumericEdit m_editNumeric;// some code

Points of Interest

Microsoft says about WM_SETTINGCHANGE :

The system sends theWM_SETTINGCHANGEmessage to all top-level windows when theSystemParametersInfofunction changes a system-wide setting or when policy settings have changed.

I checked it, it works. Currently the numeric edit box control sets it's locale by creation time. It will be much better the control to react to operation system changes. But theWM_SETTINGCHANGE message is sent only to top-level windows, not to child windows. The possible solution is to handle theWM_SETTINGCHANGEin main window and delegate theWM_SETTINGCHANGE message to all child windows, but it seams ugly. I continue find other solution of this problem.

History

  • 12.08.2003 - First version of the code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be foundhere

About the Author

Nikolai Serdiuk

Web Developer

Bulgaria Bulgaria

Member
I am a senior developer inMelon Technologies Ltd.
 


loading...
Sign Up to vote  PoorExcellent
Add a reason or comment to your vote:x
Votes of 3 or less require a comment

Comments and Discussions

 
 RefreshFirstPrevNext
GeneralMinor changesmemberTerence Russell7:55 24 Mar '05  
GeneralRe: Minor changesmemberTerence Russell8:06 24 Mar '05  
GeneralRe: Minor changesmemberDeanV7:25 1 Feb '06  
GeneralThe easy way to handle notificationsmembered welch1:26 13 Aug '03  
Last Visit: 19:00 31 Dec '99     Last Update: 3:59 5 Jan '121

General General   News News   Suggestion Suggestion   Question Question   Bug Bug   Answer Answer   Joke Joke   Rant Rant   Admin Admin   

Permalink |Advertise |Privacy |Mobile
Web04 |2.5.120104.1 |Last Updated 12 Aug 2003
Article Copyright 2003 by Nikolai Serdiuk
Everything elseCopyright ©CodeProject, 1999-2012
Terms of Use
Layout:fixed|fluid

The Daily Insider

[8]ページ先頭

©2009-2025 Movatter.jp