Author |
Topic: List Box Notification (Read 1517 times) |
|
Matt
Developer
member is offline


Gender: 
Posts: 210
|
 |
Re: List Box Notification
« Reply #21 on: Sep 2nd, 2013, 6:57pm » |
|
So does that mean, then, that SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, 0, 0 would normally be used when the dialog box already has focus, but when closing a child dialog box, what is required is to select the control of the parent box that initially requires focus, i.e. SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, ctrl%, 1?
Edit: Just realised that the ctrl% parameter should be the control handle rather than the control id. Although it does say this, I was using the id because, in my experience, it's unusual to have both the window handle and the control handle. Normally, I've found that it's either the window handle and the control id, or the control handle only.
It's sorted anyway.
Matt
|
| « Last Edit: Sep 2nd, 2013, 7:49pm by Matt » |
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: List Box Notification
« Reply #22 on: Sep 2nd, 2013, 7:59pm » |
|
on Sep 2nd, 2013, 6:57pm, Matt wrote:| So does that mean, then, that SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, 0, 0 would normally be used when the dialog box already has focus, but when closing a child dialog box |
|
It's difficult to speculate on what a particular API might 'normally' be used for. Since the action is that of the Tab key (moving the input focus to the next control having the WS_TABSTOP style), I would expect that the most likely use is exactly that, i.e. to be called (internally to Windows) when the Tab key is pressed.
Bear in mind that the API functions documented in MSDN aren't necessarily intended to be called from an application, many of them are primarily for internal use within Windows.
Quote:| what is required is to select the control of the parent box that initially requires focus |
|
I'm not sure what you mean by "parent box" in this context. Do you mean the parent window of the controls, i.e. the dialogue box itself, or the parent window of the dialogue box? Normally a dialogue box shouldn't have a parent - i.e. it shouldn't be a child window. The reason is that child windows are constrained to remain within the client area of their parent window, and the expectation is that you will be able to move a dialogue box freely anywhere on the screen.
The parent window of the controls (i.e. the dialogue box itself) should never have the input focus - I'm not even sure that it is possible. It only makes sense to give the input focus to a window which can receive input! Since the dialogue box itself can't receive input (where would it go?) it should never have the input focus.
Does that answer the question?
Richard.
|
|
Logged
|
|
|
|
Matt
Developer
member is offline


Gender: 
Posts: 210
|
 |
Re: List Box Notification
« Reply #23 on: Sep 3rd, 2013, 04:48am » |
|
It certainly does.
My mistake is for using words which aren't technically correct. What I meant by parent / child box is a dialog box called by a routine that, when a button is pressed within that box, calls yet another dialog box - which, I aggree, is not technically called a parent / child window.
Sorry for the confusion. And thanks for answering it better than I asked it.
Matt
|
|
Logged
|
|
|
|
|