Solved

Can't get mouse input for CStatic in Dialog

Posted on 2003-11-26
5
344 Views
Last Modified: 2013-11-20
Hi!

I have a CFormView that uses a dialog template. Further I have an own class called "LinkLabel" that is derived from CStatic. I add instances of this class in the OnInitialUpdate() method of CFormView by calling the "Create" method of CStatic (my class is actually a simple label that owns another CStatic displaying a bitmap).

But when I try to get mouse input for my class with the OnLButtonDown-Handler, I do not get any feedback. The WM_LBUTTONDOWN message is obviously not sent to my control.

I thought I could get rid of this by overriding the OnGetDlgCode() method, but this method isn't called by the framework, too!

So what am I doing wrong here?
0
Comment
Question by:hirnsieb
5 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 9824279
The only message I see in the class wizard for a CStatic is the BN_CLICKED. Would this be sufficient? If yes override that handler. Otherwise you need to convince the framework to send other messages to that control.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9824294
>> my class is actually a simple label that owns another CStatic displaying a bitmap.

Another CStatic gets WM_LBUTTONDOWN.
0
 
LVL 1

Author Comment

by:hirnsieb
ID: 9824400
Thanks for your suggestions.

@SteH: I think the BN_CLICKED handler refers to the owning dialog object, but I want to handle the mouse event in my CStatic derived class.

@AlexFM: it would be great if my other CStatic would get the message but in fact it doesn't. Maybe I am doing something wrong. What I do is:

1. derive a class from CStatic (called LinkLabel) and implement the OnLButtonDown handler
2. derive another class from CStatic (called LinkBitmap) and implement the OnLButtonDown handler, so I get the mouse message in any case
3. create LinkBitmap from within the "Create" method of LinkLabel (= LinkLabel is the parent)
4. add an instance of LinkLabel to my CFormView object (= CFormView is the parent)

As said before, I do not get any mouse messages in any of my two classes. But I should, shouldn't I? Or is there anything else to do, to receive those messages, i.e. create my class with special window styles, etc.?
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
ID: 9824406
In the reource editor set the 'notify' option to true (styles tab).  Now your static control will receive mouse messages and you can implement the handlers you require.
0
 
LVL 1

Author Comment

by:hirnsieb
ID: 9824438
@AndyAinscow: That's it! Thanx! I had to set the SS_NOTIFY style when creating my CStatic derived class.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question