Click here to Skip to main content
15,923,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Detect button three press Pin
Johpoke16-Nov-06 7:23
Johpoke16-Nov-06 7:23 
GeneralRe: Detect button three press Pin
Mark Salsbery16-Nov-06 7:33
Mark Salsbery16-Nov-06 7:33 
GeneralRe: Detect button three press Pin
Johpoke16-Nov-06 8:39
Johpoke16-Nov-06 8:39 
AnswerRe: Detect button three press Pin
PJ Arends15-Nov-06 16:20
professionalPJ Arends15-Nov-06 16:20 
AnswerRe: Detect button three press Pin
Hamid_RT15-Nov-06 18:39
Hamid_RT15-Nov-06 18:39 
QuestionClosing popup dialog window. Pin
xkrja15-Nov-06 7:23
xkrja15-Nov-06 7:23 
AnswerRe: Closing popup dialog window. Pin
Mark Salsbery15-Nov-06 11:23
Mark Salsbery15-Nov-06 11:23 
GeneralRe: Closing popup dialog window. Pin
xkrja15-Nov-06 21:31
xkrja15-Nov-06 21:31 
Actually I made a simplification when I described the problem. The PreTranslateMessage() checks for a TAB-keypress and as long as TAB is held down it calls CCameraControlDlg::ManualMode()

The CCameraControlDlg is the main dialog.

BOOL CCameraControlDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
	// TODO: Add your specialized code here and/or call the base class<br />
<br />
	if (GetAsyncKeyState(VK_TAB) < 0) { <br />
		CCameraControlDlg::ManualMode();<br />
	}<br />
	Sleep(10);<br />
	return CDialog::PreTranslateMessage(pMsg);<br />
<br />
}


In the CCameraControlDlg::ManualMode() function there are again and if-statement. This look for F2-keypresses as shown below. As long F2 is held down it calls the MouseScroll-function which is used for scrolling up and down a menu in the other dialog. Then m_dlgMenu.ShowWindow(SW_SHOW) are used to show the other dialog. When the F2-key is released the other if-statement will be true and should hide the window. But nothing happens until the mouse is moved (the TAB-key is still pressed).

<br />
void CCameraControlDlg::ManualMode() {<br />
.<br />
.<br />
.<br />
<br />
if ((GetAsyncKeyState(VK_F2) < 0) && ((control_nr == 2) || (control_nr == 0))) {	<br />
<br />
       x_F2 = MouseScroll(menu_roof, reset_val);<br />
 <br />
       m_dlgMenu.ShowWindow(SW_SHOW);<br />
       m_dlgMenu.m_strHeader.Format("White Balance");<br />
       m_dlgMenu.m_strChoice.Format(menu_text_F2[x_F2]);<br />
		<br />
       m_dlgMenu.UpdateData(FALSE); <br />
		<br />
       control_nr = 2;<br />
<br />
}<br />
<br />
else if (control_nr == 2) {<br />
				<br />
       m_dlgMenu.ShowWindow(SW_HIDE)<br />
       control_nr = 0;<br />
}<br />
<br />
.<br />
.<br />
.<br />
}<br />

Another thing is that it works as expected if the style of the other dialog is set to "child" instead of "popup" but when F2 is held down the dialog flickers a couple of times before it is shown , which is annoying. This is not the case when the style is "popup".

Thanks for your help
GeneralRe: Closing popup dialog window. Pin
xkrja15-Nov-06 22:16
xkrja15-Nov-06 22:16 
QuestionClient server in VC++ Pin
naish_kewl15-Nov-06 6:39
naish_kewl15-Nov-06 6:39 
AnswerRe: Client server in VC++ Pin
Mark Salsbery15-Nov-06 6:51
Mark Salsbery15-Nov-06 6:51 
GeneralRe: Client server in VC++ Pin
led mike15-Nov-06 8:44
led mike15-Nov-06 8:44 
GeneralRe: Client server in VC++ Pin
Mark Salsbery15-Nov-06 11:25
Mark Salsbery15-Nov-06 11:25 
GeneralRe: Client server in VC++ Pin
naish_kewl8-Dec-06 14:31
naish_kewl8-Dec-06 14:31 
QuestionProblem Using CString Pin
CoffeeAddict1915-Nov-06 6:36
CoffeeAddict1915-Nov-06 6:36 
AnswerRe: Problem Using CString Pin
Mark Salsbery15-Nov-06 6:49
Mark Salsbery15-Nov-06 6:49 
GeneralRe: Problem Using CString Pin
CoffeeAddict1915-Nov-06 17:29
CoffeeAddict1915-Nov-06 17:29 
GeneralRe: Problem Using CString Pin
Mark Salsbery15-Nov-06 17:52
Mark Salsbery15-Nov-06 17:52 
GeneralRe: Problem Using CString Pin
CoffeeAddict1915-Nov-06 17:59
CoffeeAddict1915-Nov-06 17:59 
GeneralRe: Problem Using CString Pin
Mark Salsbery15-Nov-06 18:04
Mark Salsbery15-Nov-06 18:04 
GeneralRe: Problem Using CString Pin
David Crow16-Nov-06 2:46
David Crow16-Nov-06 2:46 
AnswerRe: Problem Using CString Pin
David Crow15-Nov-06 6:57
David Crow15-Nov-06 6:57 
AnswerRe: Problem Using CString Pin
Maximilien15-Nov-06 8:21
Maximilien15-Nov-06 8:21 
AnswerRe: Problem Using CString Pin
George L. Jackson15-Nov-06 10:53
George L. Jackson15-Nov-06 10:53 
AnswerRe: Problem Using CString Pin
CoffeeAddict1915-Nov-06 17:31
CoffeeAddict1915-Nov-06 17:31 

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.