Click here to Skip to main content
15,918,243 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Set cursor problem Pin
namaskaaram9-Feb-05 1:05
namaskaaram9-Feb-05 1:05 
GeneralBitmap to jpeg conversion Pin
TheCult9-Feb-05 0:15
TheCult9-Feb-05 0:15 
GeneralRe: Bitmap to jpeg conversion Pin
One Stone9-Feb-05 2:23
One Stone9-Feb-05 2:23 
GeneralRe: Bitmap to jpeg conversion Pin
TheCult9-Feb-05 6:18
TheCult9-Feb-05 6:18 
QuestionHow do I add a new item to the New Shell menu Pin
Anonymous8-Feb-05 23:17
Anonymous8-Feb-05 23:17 
QuestionHow to receive Events from VB OCX ? Pin
Ro_land8-Feb-05 23:14
Ro_land8-Feb-05 23:14 
GeneralSendInput Pin
mcsherry8-Feb-05 22:04
mcsherry8-Feb-05 22:04 
GeneralFocus issues Pin
greekgoddj8-Feb-05 21:57
greekgoddj8-Feb-05 21:57 
Hello hello,

So...I am working on a ActiveX control, where when the user clicks the mouse and lets go of the mouse with the cursor over a specific area in the control, a CEdit control is made visible at the position of the ActiveX control. The user can enter a number into the CEdit control, and then when clucking outside the CEdit control, that value entered gets stored in a variable and the CEdit control becomes invinsible.

The problem comes when trying to click on that area of the ActiveX control again. the CEdit control will apear but can no longer enter any values. I cannot get that vertical line in the CEdit box that allows me to type in characters/numbers.

If I run it in debugging mode, with breakpoints at the point where the CEdit is to be shown, and where the CEdit is to be hidden, then it works pefrectly as many times as I like. I can keep clicking on that area of the control, showing the CEdit, entering a number, clicking elsehwere and hiding the CEdit, and so on and so forth.

It turns out that the reason why it works when debugging and not when not debugging is that when I have breakpoints in parts of the code, the focus leaves my control in the ActiveX control container, and goes to the VS window to show me the break point. Then when I press F5 and return back to the ActiveX container then it all works again.

Similarly, when I run the control out of debug mode, clicking on other windows or applications solves it and makes the control work.

so a sequence like this works:

1)click on the area over which the CEdit should appear,
2)CEdit appears
3)Enter a value
4)click outside the CEdit
5)CEdit disapears
6) >>click on other window/application/desktop etc<<
7)click back on ActiveX container
8) Go to step 1.

Without step 6, I canot get step 2 to happen more than once.

We thought it maybe a matter of focus. So, the code was changed so that when the CEdit control appears it also gets the focus, and when the user clicks elsewhere and the CEdit hides, that the parent control gets the focus.

I have put the code below...anybody who has actually read so far into this post might as well have a look at it. thanks! Big Grin | :-D

<br />
LRESULT CKnob::OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)<br />
{<br />
	m_bMouseDown = false;<br />
<br />
	RECT tempRect;<br />
	GetClientRect(&tempRect);<br />
	int nLeft = (tempRect.right - tempRect.left) / 2 - KNOBSIZE / 2;<br />
	int nTop = (tempRect.bottom - tempRect.top) / 2 + KNOBSIZE / 2;<br />
	//If mouse Up WITHIN the text area<br />
	if((LOWORD(lParam) >= nLeft) && (LOWORD(lParam) <= nLeft + KNOBSIZE) <br />
		&& (HIWORD(lParam) >= nTop) && (HIWORD(lParam) <= nTop + TEXTAREA))<br />
	{<br />
		m_bShowCEdit = true;<br />
		CString tempString;<br />
		tempString.Format("%ld", m_nPosition);<br />
		m_editValue.SetWindowText(tempString);<br />
		int a = m_editValue.ShowWindow(SW_SHOW);<br />
		m_editValue.SetFocus();<br />
	}<br />
	//If mouse Up OUTSIDE the text area<br />
	else<br />
	{<br />
		if(m_bShowCEdit == true)	// if the CEdit is already showing<br />
		{<br />
			CString strTemp;<br />
			m_editValue.GetWindowText(strTemp);<br />
			m_nPosition = _ttoi(strTemp);<br />
			int b = m_nPosition = max(m_nMin, min(m_nPosition, m_nMax));<br />
			m_editValue.ShowWindow(SW_HIDE);	//Hide it<br />
			this->SetFocus();<br />
		}<br />
		m_bShowCEdit = false;		// No longer showing<br />
	}<br />
<br />
	return 0;<br />
}<br />

Questionhow to change printers without PrintDialog? Pin
george ivanov8-Feb-05 21:19
george ivanov8-Feb-05 21:19 
AnswerRe: how to change printers without PrintDialog? Pin
Anonymous8-Feb-05 21:58
Anonymous8-Feb-05 21:58 
AnswerRe: how to change printers without PrintDialog? Pin
g3e8-Feb-05 23:02
g3e8-Feb-05 23:02 
Questionhow to disable close button of CPropertySheet? Pin
includeh108-Feb-05 20:59
includeh108-Feb-05 20:59 
Generalwindows error help Pin
Tariq8788-Feb-05 20:40
Tariq8788-Feb-05 20:40 
GeneralRe: windows error help Pin
includeh108-Feb-05 21:04
includeh108-Feb-05 21:04 
GeneralRe: windows error help Pin
2249178-Feb-05 21:55
2249178-Feb-05 21:55 
QuestionHow do you capture a run on C++? Pin
Atptour8-Feb-05 20:34
Atptour8-Feb-05 20:34 
AnswerRe: How do you capture a run on C++? Pin
David Crow9-Feb-05 2:28
David Crow9-Feb-05 2:28 
AnswerRe: How do you capture a run on C++? Pin
pc_dev9-Feb-05 21:12
pc_dev9-Feb-05 21:12 
Generalclose process Pin
includeh108-Feb-05 20:10
includeh108-Feb-05 20:10 
GeneralRe: close process Pin
toxcct8-Feb-05 21:30
toxcct8-Feb-05 21:30 
Generalmessage of CPropertySheet Pin
includeh108-Feb-05 19:54
includeh108-Feb-05 19:54 
GeneralRe: message of CPropertySheet Pin
2249178-Feb-05 21:46
2249178-Feb-05 21:46 
Generalhelp on display modes Pin
uday__m8-Feb-05 19:53
uday__m8-Feb-05 19:53 
GeneralProblem in Printing a Page? using VC++ Pin
zahid_ash8-Feb-05 19:52
zahid_ash8-Feb-05 19:52 
Generalcan't register com dll Pin
Rassul Yunussov8-Feb-05 19:20
Rassul Yunussov8-Feb-05 19:20 

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.