15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Ignoring first click

Paul Martinsen -- pmartinsen@hort.cri.nz
Monday, February 10, 1997

Environment: VC++ 4.0, Win 95	

Hello All,

I have a MDI app created with the App wizard. I want the views to
ignore the mouse click that activates them. I can do this for the
application by processing OnMouseActivate in CMainFrame and returning
MA_ACTIVATEANDEAT if the app is in the foreground, but my view seems
to get WM_MOUSEACTIVATE messages very time there is a mouse click,
and not "...when the cursor is in an inactive window and the user
presses a mouse button." (MFC On-line help -- OnMouseActivate) like 
the documentation suggests.

I was wondering if this may be caused by the view being a child of a 
MDIFrame & therefore not active? But I tried processing 
OnMouseActivate in the frame and this didn't work either.

Any suggestions?
Kind Regards,
Paul Martinsen.
Paul Martinsen.
---------------------------------------------------------------
PhD Student.    p.martinsen@auckland.ac.nz
Deparment of Electrical and Electronic Engineering
University of Auckland.               Hort+Research
Private Bag                           Ruakura Research Centre
Auckland                              Hamilton.
New Zealand                           New Zealand.
---------------------------------------------------------------



Ajay K Sanghi -- sanghi@giasdl01.vsnl.net.in
Monday, February 10, 1997

[Mini-digest: 2 responses]



On Mon, 10 Feb 1997, Paul Martinsen wrote:

> Environment: VC++ 4.0, Win 95	
> 
> Hello All,
> 
> I have a MDI app created with the App wizard. I want the views to
> ignore the mouse click that activates them. I can do this for the
> application by processing OnMouseActivate in CMainFrame and returning
> MA_ACTIVATEANDEAT if the app is in the foreground, but my view seems
> to get WM_MOUSEACTIVATE messages very time there is a mouse click,
> and not "...when the cursor is in an inactive window and the user
> presses a mouse button." (MFC On-line help -- OnMouseActivate) like 
> the documentation suggests.
> 
> I was wondering if this may be caused by the view being a child of a 
> MDIFrame & therefore not active? But I tried processing 
> OnMouseActivate in the frame and this didn't work either.
> 
> Any suggestions?
> Kind Regards,
> Paul Martinsen.
> Paul Martinsen.
> ---------------------------------------------------------------
> PhD Student.    p.martinsen@auckland.ac.nz
> Deparment of Electrical and Electronic Engineering
> University of Auckland.               Hort+Research
> Private Bag                           Ruakura Research Centre
> Auckland                              Hamilton.
> New Zealand                           New Zealand.
> ---------------------------------------------------------------
> 
Hi, 
You are handling the message in CMainFrame which means, this processing 
will be invoked only if user clicks in MainFrame window. Because of this 
only your message handling in CMainFrame or Frame window is not getting 
invoked when you click in view or any other window except mainframe.
So, try the same thing in CView derrived class itself.

Ashok

-----From: "C.Zhang" 

I implemented the OnMouseActivate in MDI Child frame and it seems
working properly.

Paul Martinsen wrote:
> 
> Environment: VC++ 4.0, Win 95
> 
> Hello All,
> 
> I have a MDI app created with the App wizard. I want the views to
> ignore the mouse click that activates them. I can do this for the
> application by processing OnMouseActivate in CMainFrame and returning
> MA_ACTIVATEANDEAT if the app is in the foreground, but my view seems
> to get WM_MOUSEACTIVATE messages very time there is a mouse click,
> and not "...when the cursor is in an inactive window and the user
> presses a mouse button." (MFC On-line help -- OnMouseActivate) like
> the documentation suggests.
> 
> I was wondering if this may be caused by the view being a child of a
> MDIFrame & therefore not active? But I tried processing
> OnMouseActivate in the frame and this didn't work either.
> 
> Any suggestions?
> Kind Regards,
> Paul Martinsen.
> Paul Martinsen.
> ---------------------------------------------------------------
> PhD Student.    p.martinsen@auckland.ac.nz
> Deparment of Electrical and Electronic Engineering
> University of Auckland.               Hort+Research
> Private Bag                           Ruakura Research Centre
> Auckland                              Hamilton.
> New Zealand                           New Zealand.
> ---------------------------------------------------------------




Become an MFC-L member | Вернуться в корень Архива |