-
September 4th, 2002, 08:45 AM
#1
SetSel() SetFocus() problems in modal dlg
How can I set the current selection to the entire word when I display a modal dialog? I have tried putting the code in the OnInitDialog(), OnShowWindow(), and also before I display the dialog but nothing works? I would also like to set the focus to that dialog but that is not working either. Here is some of the code:
HTREEITEM hTreeItem = GetSelectedItem();
CChangeOverlayDlg overlayDlg;
overlayDlg.m_OverlayName = GetItemText( hTreeItem );
// It crashes if I put it here.
overlayDlg.m_NameCtrl.SetSel( 0, -1 );
overlayDlg.SetFocus();
if ( overlayDlg.DoModal() == IDOK )
{
SetItemText( hTreeItem, overlayDlg.m_OverlayName );
}
Thanks.
-
September 4th, 2002, 12:38 PM
#2
Set focus to the edit in OnInitDialog, but return FALSE (instead of TRUE, which is "the default)
-
September 4th, 2002, 04:05 PM
#3
Thanks. That worked. Is there a way to highlight the current selection when using modal dialogs? Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|