|
Thanks.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hello,
I want my button to be clicked only once and not twice.
What to do.
Thanks In Advance.
Dhiraj
|
|
|
|
|
How about disabling the button after the first click?
|
|
|
|
|
actually what i want is that the user can only fire single click event and not double click.
That is my meaning of disabling actually the button is not disabled but double click should not do any thing. It should not change its state.
|
|
|
|
|
As far as i know -and please correct me anyone if i am wrong- if the user doubleclicks your button you will get a click event at first. So at the first click you won't be able to know if the user will doubleclick or just singleclick. To be more clear on this, when the user doubleclicks your button, you get 2 command messages from the button and you either want only one of these or if a doubleclick was done you don't want any command messages at all?
|
|
|
|
|
u can use PreTranslateMessage(MSG* pMsg) like this
BOOL [ur class name]::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
|
|
|
|
|
Just add both a single-click handler and a double-click handler to the button, and do nothing for a double click.
|
|
|
|
|
or simply call the single-click handler from the double-click handler
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
He said he wants it to do nothing on a double click.
|
|
|
|
|
That is fine if that is what he wants. But I was thinking of the user who will start rapidly clicking the button only to find that every other click does not work as expected.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
you can use Pretranslatemessage method
BOOL <your class="" name="">::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
or
u can map lbuttondblclk and then post a message of WM_LBUTTONDOWN(best for activex button controls)
|
|
|
|
|
How about simply removing the double click style from the window's class?
BOOL YourButtonClass::PreCreateWindow(CREATESTRUCT &cs)
{
WNDCLASS wndClass = { 0 };
GetClassInfo(NULL, cs.lpszClass, &wndClass);
wndClass.style &= ~CS_DBLCLKS;
wndClass.lpszClassName = _T("BUTTON-DBLCLKS");
if (AfxRegisterClass(&wndClass))
{
cs.lpszClass = wndClass.lpszClassName;
}
return __super::PreCreateWindow(cs);
}
|
|
|
|
|
Hello All
I am building my project Visual Studio.Net 2003. It is a big project that inturn consists of 83 small projects.....during the compilation of some project i am getting the error:
Project : error PRJ0019: A tool returned an error code: "Performing Pre-Build Event..."
Please suggest how this can be fixed.
waiting for suggestions.
|
|
|
|
|
In the project's property pages check out Build Events->Pre-build event and see what might be causing the problem.
|
|
|
|
|
How to place a button control over a picture control or some other control
|
|
|
|
|
You mean programatically? Well, you can make the picture control the parent of the button or you can use SetWindowPos to setup a Z-Order in which the button is over the picture control. Also if you choose to do the later, have the WS_CLIPSIBLINGS style set on your picture control.
|
|
|
|
|
The solution was given in your previous post. Dint you try that?
|
|
|
|
|
hi, I am using VS2002 for a client
need to have a round corner combobox VC++/MFC
if Anyone can help?
Thanks in Advance
|
|
|
|
|
This article[^] may help.
Regards,
Sandip.
|
|
|
|
|
Lots of thanks
|
|
|
|
|
Very interesting article; thanks for the link!
|
|
|
|
|
Hi,
I have created an SDI application and created a new class "CMyClass" that is derived from CObject. So I have included the header file "stdafx.h/afx.h " in CMyClass.h. I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h.When I do so and compile I am getting the "warning C4182: #include nesting level is 360 deep; possible infinite recursion" and "fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit".
In order to solve the problem , I have maximum tried to minimize the inclusion of header files. But couldn't.
How to solve this problem?
Thanks in advance.
Taruni
|
|
|
|
|
Taruni wrote: I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h
Possibly you're including MyClass.h in MyDoc.h and viceversa.
you may use
#pragma once
at the top of you header files to prevent multiple inclusion.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you Pallini.
#program once is already there in all the header files except in MyClass.h.When I tried to include, I am getting the errors
'CMyClass' : is not a class or namespace name
syntax error : identifier 'CMyClass'
syntax error : missing ';' before '}'
syntax error : missing ';' before '}'
.
.
.
.
.
fatal error C1003: error count exceeds 100; stopping compilation
Taruni
|
|
|
|
|
What is the source file the error is given for?
Have you included MyClass.h in that source file?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|