- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a dialog box with a number of fields, some are edit boxes and some are drop down combo boxes.
When I press Return I want the cursor to move down to the next field.
This works for the edit boxes but not for the combo boxes.
I am using a Return button as the default button and code as shown
if (imess==EN_SETFOCUS) then
IDControl=iCtrl
elseif (imess==EN_CHANGE) then
PGMDescProc1 = 0
IDControl=iCtrl! for Return
return
end if
IDControl=iCtrl
elseif (imess==EN_CHANGE) then
PGMDescProc1 = 0
IDControl=iCtrl! for Return
return
end if
What do I need to do to get the combo to waork as well?
Thanks,
David
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
It's not clear to me where is that code located and what's your setup. Do you use technique (or similar to) described here? I think it works for any type of control.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that's the method I'm using.
It works for edit boxes but not drop downs.
Maybe it is because it uses EN_CHANGE, what would be the equivalent for a drop down?
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But I don't see how EN_CHANGE or any notification fits in that method? The method is based on behaviour that on Enter key IsDialogMessage sends a WM_COMMAND with idDefaultButton and BN_CLICKED (because it's a button). You cannot really distinguish what was the state before Enter key(although WM_NEXTDLGCTL will work correctly). EN_* will noteverbesent to a button. One of us is missing something?
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've just had a chance to get back to this problem.
I'll try to explain it.
To use the 'getthe next control' you have to know where you are, so youcanget the next one.
With an edit box
iCtrl=LOWORD(wParam)
iMess=HIWORD(wParam)
iMess=HIWORD(wParam)
if(imess==EN_SETFOCUS) then
current_control=iCtrl
end if
gives the ID of the control.
To get it to work with an edit box and a combo you need the following
if (imess==EN_SETFOCUS.OR.imess==CBS_DROPDOWNLIST) then
I have added CBS_DROPDOWNLIST and it now works as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, this is the source of misunderstanding:
To use the 'getthe next control' you have to know where you are, so youcanget the next one.
My point was that you don't have to know where you are. The following is a callback for a hidden default button used for this purpose: (under DFLOGM, but you can use the same approach in WM_COMMAND/idDefaultButton):
SUBROUTINE OnMovementNext(Dlg2, ID, iAction)
USE XFLOGM
USE DFWIN
USE DFWIN
TYPE(Dialog):: Dlg2
iSt=PostMessage(Dlg2%hWnd, WM_NEXTDLGCTL, 0, 0)
END SUBROUTINE OnMovementNext
To clarify, I referred to approach where you use a hidden default button for handling the Enter key. An alternative is to subclass controls, but that tends to be overcomplicated as you have to subclass 'em all.
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page