|
The following MFC code calls my own OnInitDialog function which in turn sets focus to my dialog window's first control and then returns a boolean value of FALSE. However, the focus is NOT set and tabbing fails when my dialog page appears. WHY?????? Is there a problem with MFC?
The focus setting works when a dialog in initiated via the MFC "DoModal()" command.
Thank you for your assistance.
/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc
INT_PTR CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}
Michael A. Rinaldi
|
|
|
|
|
You do not need to post your question more than once. Please read the forum guidelines.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
See here[^]. In short calling SetFocus should not be calling in dialogs: instead WM_NEXTDLGCTL should be used.
Steve
|
|
|
|
|
The following MFC code calls my own OnInitDialog function which in turn sets focus to my dialog window's first control and then returns a boolean value of FALSE. However, the focus is NOT set and tabbing fails when my dialog page appears. WHY?????? Is there a problem with MFC?
The focus setting works when a dialog in initiated via the MFC "DoModal()" command.
Thank you for your assistance.
/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc
INT_PTR CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}
Michael A. Rinaldi
|
|
|
|
|
Showing the MFC code doesn't really help us
What are you doing in your derived class OnInitDialog? How are you setting focus to a control?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark:
Sorry about that.
Here's my app's function that's called by the MFC code. I'm adding my own supplementary comments.
BOOL CSetupDlgMyApp::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateMyNames(); // updates class object parameters
GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
// focus to its first control
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Thank you for your assistance.
Michael A. Rinaldi
Michael A. Rinaldi
|
|
|
|
|
Maybe try this instead:
//GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
GotoDlgCtrl(GetDlgItem(IDC_RENAME_ACCOUNT));
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
MRCres wrote: GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
// focus to its first control
Is IDC_RENAME_ACCOUNT the first non-static control in the dialog's z-order?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, it is.
Michael A. Rinaldi
|
|
|
|
|
Then there's no need to call SetFocus() or return FALSE .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Focus is being set to the first control upon dialog activation and initialization; however, tabbing is inoperative until one touches the first control to activate the subdialog. After the subdialog is opened and closed, tabbing works on the dialog controls.
Although tab controls and ordering are set in the MFC resource editor, why is tabbing not working and inoperative upon dialog window initialization and activation?
(Note that the window display occurs on a touch panel screen whereby the touching of a button is handled like a LEFT MOUSE DOWN\UP command.)
Thank you for your assistance.
Michael A. Rinaldi
|
|
|
|
|
Hi,
I am trying to use this function
<br />
CWnd::FlashWindowEx()<br />
in my CMainFrm class but it cannot compile returning the error
error C2065: 'FlashWindowEx' : undeclared identifier
However, if I use
<br />
CWnd::FlashWindow()<br />
It is ok. Does anyone know why the call to CWnd::FlashWindow() does not work ?
Thanks.
ps I have ommitted the arguements in this post.
|
|
|
|
|
Maybe you have an old version of MFC (for instance, VS6 MFC doesn't have the CWnd::FlashWindowEx method while it has the CWnd::FlashWindow one). As workaround, try to use the Win32 FlashWindowEx function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
|
i want to extract the port information of other pc's on my lan like on which port which .exe or process is going .
Thanks
Sumedh
|
|
|
|
|
can anyone show me how to read from a text file i have opened and written to using cfile.
eg this is how i opened and wrote to the file.Check1 is a boolean variable.i would like to retrieve the value of that boolean variable.
CFile LoggingObject;
CString txt;
txt.Format("%d", check1);
LoggingObject.Open( "c:\\test.txt", CFile::modeCreate|CFile::modeReadWrite);
LoggingObject.Write (txt,sizeof(txt));
|
|
|
|
|
Since you knew how to use the Write() method, I'm surprised that you overlooked the Read() method.
sivern wrote: LoggingObject.Write (txt,sizeof(txt));
This should be:
LoggingObject.Write(txt, txt.GetLength()); Or:
LoggingObject.Write(&check1, sizeof(int));
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
Please give me an example of how i can parse the xml file using VC++/C++.I have seen many examples on net but none is clear.
Regards
|
|
|
|
|
See here, here, here, here, and here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Maynka wrote: Please give me an example of how i can parse the xml file using VC++/C++.I have seen many examples on net but none is clear.
just come across today http://www.codeproject.com/useritems/CXml.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
I,m not sure if this is the right place to ask, but...
I use:
<br />
#include <atlbase.h><br />
#include <atlcom.h><br />
in my code , and keep getting err message on building:
"error C2065: '_Module' : undeclared identifier". '_Module' is in ATLCOM.H folder.
Thanks for help in advance!
|
|
|
|
|
Have you tried:
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
hi guys,i am trying a 3-D dynamic array in C.i know how to do it for 2-D but i dont konw what i am missing to do it properly for 3-D
say h*w are the size of a matrix
int **matrix=NULL;
matrix=malloc(h*sizeof(int));
for(i=0;i
|
|
|
|