- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to set the focus of an edit box on a simple dialog project.
I can't see anything to do with this in the SetDlg function.
How do you do it?
Thanks,
David
I can't see anything to do with this in the SetDlg function.
How do you do it?
Thanks,
David
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's no DlgSet equivalent, but you can use SetFocus(GetDlgItem(Dlg%hWnd), idControl), or, better, WM_NEXTDLGCTL.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I have used the SetFocus function.
If the ID is a button then the button is highlighted - but the ID is an edit box - I expect the cursor to be placed at the first character of the edit box ready for typing but nothing appears to happen. Is there something more I have to do?
David
If the ID is a button then the button is highlighted - but the ID is an edit box - I expect the cursor to be placed at the first character of the edit box ready for typing but nothing appears to happen. Is there something more I have to do?
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From where are you calling SetFocus? This will work only when called from a callback routine (if the dialog is modal) or after DlgModeless (if it's modeless).
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is being called from a callback routine from a modal dialog box - I think I have the termonology right.
SUBROUTINE IsoCheck(dlg,id,callbacktype ) !----------------------------------------- !Dialog box callback for Iso Check use dfwin use dflogm use Vol99Globals include 'resource.fd' type (dialog) dlg integer*4 id,callbacktype,iret logical*4 lret if (callbacktype == dlg_clicked) then lret = DlgGet(dlg, id, iso) lret = DlgSet(dlg,IDC_JOB3,iso,dlg_enable) if (iso) then iret=SetFocus(GetDlgItem(dlg%hwnd,IDC_JOB3)) end if endif END SUBROUTINE IsoCheck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmph... don't have time to try this at the moment, but that IMO should have worked.
Still, try Send/PostMessage(Dlg%hWnd, WM_NEXTDLGCTL, 1, GetDlgItem(Dlg%hWnd, IDC_JOB3)) instead. If I recall correctly, that will also select the text within the control, if any.
Jugoslav
Still, try Send/PostMessage(Dlg%hWnd, WM_NEXTDLGCTL, 1, GetDlgItem(Dlg%hWnd, IDC_JOB3)) instead. If I recall correctly, that will also select the text within the control, if any.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That didn't work either.
Looking back over all the work I have done, SetFocus has never worked for a Edit Box in a simple dialog application, but is OK on a API application.
There must be something missing in my initialisation.
David
Looking back over all the work I have done, SetFocus has never worked for a Edit Box in a simple dialog application, but is OK on a API application.
There must be something missing in my initialisation.
David

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