- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello NG,
I'm trying to build something quite easy, a simple input dialog with 2 buttons and 1 edit box. My problem is the following: I would like to set the focus on the edit box when the dialog is first opened, in order to avoid the use of the mouse. The user would start typing things inside the edit box without clicking on it before (to activate it).
I designed something with the resource editor, and I wrote this piece of code (my edit box is IDC_EDIT1):
I designed something with the resource editor, and I wrote this piece of code (my edit box is IDC_EDIT1):
PROGRAM MIOMES
USE DFLOGM
USE DFWIN
USE DFLOGM
USE DFWIN
IMPLICIT NONE
INCLUDE 'RESOURCE.FD'
TYPE (dialog) dlg
LOGICAL returno, retlog, value
INTEGER results, iret, prevHwnd
CHARACTER(256) text
EXTERNAL OnDlgInit
INCLUDE 'RESOURCE.FD'
TYPE (dialog) dlg
LOGICAL returno, retlog, value
INTEGER results, iret, prevHwnd
CHARACTER(256) text
EXTERNAL OnDlgInit
returno = DLGINIT( IDD_DIALOG1, dlg )
retlog = DLGSET (dlg, IDC_EDIT1, '')
prevHwnd = GetDlgItem(dlg%hWnd,IDC_EDIT1)
prevHwnd = SetFocus(prevHwnd)
prevHwnd = SetFocus(prevHwnd)
retlog = DlgSetSub(dlg,IDD_DIALOG1,OnDlgInit)
results = DLGMODAL (dlg)
value = DLGGET (dlg, IDC_EDIT1, text)
CALL DlgUninit( dlg )
END PROGRAM MIOMES
SUBROUTINE OnDlgInit(dlg, id, callbacktype)
USE DFLOGM
USE DFWIN
TYPE (dialog) dlg
INTEGER id, callbacktype, prevHwnd
INCLUDE 'RESOURCE.FD'
USE DFWIN
TYPE (dialog) dlg
INTEGER id, callbacktype, prevHwnd
INCLUDE 'RESOURCE.FD'
prevHwnd = GetDlgItem(dlg%hWnd,IDC_EDIT1)
prevHwnd = SetFocus(prevHwnd)
prevHwnd = SetFocus(prevHwnd)
end subroutine OnDlgInit
But It does not work. The dialog is created but the edit box has not the focus... could you please give some suggestions?
Thank you a lot.
Andrea.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Select the dialog in the Resource editor, choose menu item 'Layout' then 'Tab order', then click on the edit box. This should put it first in the tab order, so that it will have focus when you open the dialog. HTH
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