Click here to Skip to main content
15,889,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ 2008 query Pin
Jochen Arndt29-Nov-13 23:03
professionalJochen Arndt29-Nov-13 23:03 
GeneralRe: Visual C++ 2008 query Pin
Anthony Appleyard29-Nov-13 23:10
Anthony Appleyard29-Nov-13 23:10 
Questiondrawing butterfly network Pin
Member 1041597029-Nov-13 9:04
Member 1041597029-Nov-13 9:04 
AnswerRe: drawing butterfly network Pin
Richard Andrew x6429-Nov-13 15:01
professionalRichard Andrew x6429-Nov-13 15:01 
SuggestionRe: drawing butterfly network Pin
Richard MacCutchan29-Nov-13 22:37
mveRichard MacCutchan29-Nov-13 22:37 
QuestionCDialogbar's button tooltip can't show Pin
D.Manivelan29-Nov-13 2:16
D.Manivelan29-Nov-13 2:16 
SuggestionRe: CDialogbar's button tooltip can't show Pin
Richard MacCutchan29-Nov-13 6:07
mveRichard MacCutchan29-Nov-13 6:07 
QuestionMultiple dynamically created Spin Button Controls Pin
gokings27-Nov-13 11:37
gokings27-Nov-13 11:37 
Hello,

ENVIRONMENT: MFC

I seek help regarding the dynamic creation and use of Spin Button Controls.

Every example/tutorial I've found provides a lot of information, all of which I already know.

They all state the obvious, and avoid addressing the only non-obvious (at least to me) aspect.

When dealing with a statically created (or a single dynamically created) control, "up" and "down" messages are generally handled by a method of the spin button's parent window, having a prototype such as:

void Dlg::OnDeltaposSpinFoo(NMHDR* pNMHDR, LRESULT* pResult)
{
}


The NMHDR* parm can be type cast to an NMUPDOWN*, which provides data specific to a Spin Button Control.


The message map for the parent window contains an entry such as:

ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ADJUST_FOO, OnDeltaposSpinFoo)


In such a case, it's obvious which spin control has been clicked, since the method is invoked for only a single control.

Suppose I want a range of ID's to be associated with OnDeltaposSpinFoo()?

Say I dynamically create a number of spin controls on a window, for which I wish to use a single message handler.

For some controls, such as buttons, there are "range" macros that may be placed in the message map.

How about for a spin button control?

If I could manage to have OnDeltaposSpinFoo() called for a range of ID's, I could identify the control by the idFrom member of the NMHDR parm (see structures below). I'd probably subtract a base value from the idFrom value to obtain an index to be used programmatically).

[
The relevant structures are:

typedef struct tagNMHDR {
  HWND     hwndFrom;
  UINT_PTR idFrom;
  UINT     code;
} NMHDR;

typedef struct _NM_UPDOWN {
  NMHDR hdr;
  int   iPos;
  int   iDelta;
} NMUPDOWN, *LPNMUPDOWN;

]

The bottom-line questions are:

1) How can I place an entry in the message map that will cause a "spin button prototype" function to be called (with an NMUPDOWN*) for a range of control ID's?

2) If that's not possible, how else can I handle the problem?



I'd appreciate suggestions.

Even more, I'd appreciate a working example project that will build and run using Visual Studio 2008 (I don't expect anyone to spend a lot of time creating one, but if you have one, or can quickly create one
from something you have....).
AnswerRe: Multiple dynamically created Spin Button Controls Pin
Richard MacCutchan27-Nov-13 22:15
mveRichard MacCutchan27-Nov-13 22:15 
GeneralRe: Multiple dynamically created Spin Button Controls Pin
gokings28-Nov-13 7:08
gokings28-Nov-13 7:08 
QuestionCJBK_View::OnDraw(CDC* p_DC) Pin
BarryPearlman27-Nov-13 10:50
BarryPearlman27-Nov-13 10:50 
AnswerRe: CJBK_View::OnDraw(CDC* p_DC) Pin
Richard MacCutchan27-Nov-13 22:10
mveRichard MacCutchan27-Nov-13 22:10 
AnswerRe: CJBK_View::OnDraw(CDC* p_DC) Pin
BarryPearlman28-Nov-13 10:28
BarryPearlman28-Nov-13 10:28 
GeneralRe: CJBK_View::OnDraw(CDC* p_DC) Pin
Richard MacCutchan28-Nov-13 22:41
mveRichard MacCutchan28-Nov-13 22:41 
QuestionFriend Operators of Template Classes Pin
Skippums27-Nov-13 7:00
Skippums27-Nov-13 7:00 
AnswerRe: Friend Operators of Template Classes Pin
Freak3027-Nov-13 22:05
Freak3027-Nov-13 22:05 
GeneralRe: Friend Operators of Template Classes Pin
Skippums29-Nov-13 14:35
Skippums29-Nov-13 14:35 
AnswerRe: Friend Operators of Template Classes Pin
Stefan_Lang27-Nov-13 22:40
Stefan_Lang27-Nov-13 22:40 
GeneralRe: Friend Operators of Template Classes Pin
Skippums29-Nov-13 14:34
Skippums29-Nov-13 14:34 
GeneralRe: Friend Operators of Template Classes Pin
Stefan_Lang2-Dec-13 0:17
Stefan_Lang2-Dec-13 0:17 
QuestionFindFirstFile not working Pin
sachanratnesh26-Nov-13 18:58
sachanratnesh26-Nov-13 18:58 
AnswerRe: FindFirstFile not working Pin
Jochen Arndt26-Nov-13 20:59
professionalJochen Arndt26-Nov-13 20:59 
AnswerRe: FindFirstFile not working Pin
Richard MacCutchan26-Nov-13 22:59
mveRichard MacCutchan26-Nov-13 22:59 
AnswerRe: FindFirstFile not working Pin
Gisle Vanem26-Nov-13 23:50
Gisle Vanem26-Nov-13 23:50 
AnswerRe: FindFirstFile not working Pin
Joe Woodbury27-Nov-13 4:21
professionalJoe Woodbury27-Nov-13 4:21 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.