Click here to Skip to main content
16,004,974 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem Refreshing Screen Pin
popo8420-Apr-05 21:03
popo8420-Apr-05 21:03 
GeneralI need some much needed help, LOL! Pin
Atptour19-Apr-05 16:40
Atptour19-Apr-05 16:40 
GeneralRe: I need some much needed help, LOL! Pin
Christian Graus19-Apr-05 17:45
protectorChristian Graus19-Apr-05 17:45 
GeneralRe: I need some much needed help, LOL! Pin
Atptour20-Apr-05 1:58
Atptour20-Apr-05 1:58 
GeneralRe: I need some much needed help, LOL! Pin
Christian Graus20-Apr-05 13:02
protectorChristian Graus20-Apr-05 13:02 
GeneralRe: I need some much needed help, LOL! Pin
David Crow20-Apr-05 2:14
David Crow20-Apr-05 2:14 
GeneralRe: I need some much needed help, LOL! Pin
FlyingTinman20-Apr-05 8:49
FlyingTinman20-Apr-05 8:49 
GeneralSetFocus() causes infinite loop Pin
elephantstar19-Apr-05 12:32
elephantstar19-Apr-05 12:32 
I have three fields that I validate once I press enter or when I click or tab to a different control in the window. It works fine when I press enter because it actually sets the focus on the field that it just validated if an error was thrown. Tabbing or clicking to another control sends a message but it does not set the focus back to the control. When I insert SetFocus() on the control it causes an infinite loop because it acts as if the focus for that other control I just clicked or tab to was lost. How do I intercept the focus so that it sets it back to the control it just validated. Here is my code below:

BOOL CSelectPlatform::OnCommand(WPARAM wParam, LPARAM lParam)
{
UINT notificationCode = (UINT) HIWORD(wParam);

if((notificationCode == EN_KILLFOCUS) ||
(notificationCode == LBN_KILLFOCUS) ||
(notificationCode == CBN_KILLFOCUS) ||
(notificationCode == NM_KILLFOCUS) ||
(notificationCode == WM_KILLFOCUS)) {
CWnd *pFocus = CWnd::GetFocus(); // call to a static function

// If we are changing the focus to another control of the same window...
if(pFocus && (pFocus->GetParent() == this))
{
if(pFocus->GetDlgCtrlID() != IDCANCEL)
ValAndSubmit(LOWORD(wParam));
}
}
return CFormView::OnCommand(wParam, lParam);
}

BOOL CSelectPlatform::ValAndSubmit(int DlgCtrlID)
{
BOOL bIsOk = FALSE;
CString Error;
CStn st;

CString str;
Error.Empty();
UpdateData(TRUE);
switch(DlgCtrlID)
{
case IDC_FILE:
if (m_file.IsEmpty())
{
Error = "Please enter a filename";
//GetDlgItem(IDC_FILE)->SetFocus(); //causes infinite loop
}
break;
case IDC_ITEM1:
if (m_item1.IsEmpty())
Error = "Please enter item number 1.");
break;
}
if(!(Error.IsEmpty())) {
MessageBox(Error);
}

GeneralRe: SetFocus() causes infinite loop Pin
James R. Twine20-Apr-05 8:10
James R. Twine20-Apr-05 8:10 
GeneralSetting audio "default device" Pin
wilsonian19-Apr-05 11:46
wilsonian19-Apr-05 11:46 
GeneralRemebering the position of a dialog box Pin
itsh1119-Apr-05 11:09
itsh1119-Apr-05 11:09 
GeneralRe: Remebering the position of a dialog box Pin
Ravi Bhavnani19-Apr-05 12:09
professionalRavi Bhavnani19-Apr-05 12:09 
GeneralExchange variables betweeen CPPs. Pin
Anonymous19-Apr-05 10:35
Anonymous19-Apr-05 10:35 
GeneralRe: Exchange variables betweeen CPPs. Pin
ThatsAlok20-Apr-05 0:30
ThatsAlok20-Apr-05 0:30 
GeneralADO Database connect with MS acces Pin
Member 166386919-Apr-05 10:33
Member 166386919-Apr-05 10:33 
GeneralC++ Builder/ Client Server Pin
brilliant10119-Apr-05 10:14
brilliant10119-Apr-05 10:14 
GeneralIE Proxy Switcher Deskband Pin
Matthew Devine19-Apr-05 9:56
Matthew Devine19-Apr-05 9:56 
GeneralRe: IE Proxy Switcher Deskband Pin
Gerald Schwab19-Apr-05 10:26
Gerald Schwab19-Apr-05 10:26 
GeneralRe: IE Proxy Switcher Deskband Pin
Matthew Devine20-Apr-05 10:32
Matthew Devine20-Apr-05 10:32 
GeneralRe: IE Proxy Switcher Deskband Pin
Gerald Schwab20-Apr-05 14:43
Gerald Schwab20-Apr-05 14:43 
Questionhow can i add 3D world scene into movie Pin
Tifa_Mido19-Apr-05 8:51
Tifa_Mido19-Apr-05 8:51 
GeneralExternal mode problem Pin
John Shaw19-Apr-05 7:54
John Shaw19-Apr-05 7:54 
GeneralQuestion about GDI+ Pin
Member 178245019-Apr-05 7:24
Member 178245019-Apr-05 7:24 
GeneralRe: Question about GDI+ Pin
Michael Dunn19-Apr-05 8:53
sitebuilderMichael Dunn19-Apr-05 8:53 
GeneralRe: Question about GDI+ Pin
David Crow19-Apr-05 9:52
David Crow19-Apr-05 9:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.