Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can't get mouse input for CStatic in Dialog

Posted on 2003-11-26
5
Medium Priority
?
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 45

Accepted Solution

by:
AndyAinscow earned 500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

609 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