Solved

TStatic needs MouseEvents

Posted on 1997-05-03
6
281 Views
Last Modified: 2012-05-04
Hi guys,

I have a little problem using OWL 5.0
I use a recource with an static-frame. In this static-frame I draw a picture. In the code I use a TDialog for the dialog and a TStatic for the static-frame. This works OK.

I want the static to have MouseInput, But it just can't get the TStatic to respond to MouseEvents. I guess the problem is that the static doesn't get input-focus.

In fact I want to create a child-window in a dialog from recource-data (with etched border), so that I can use TClientDC etc for the drawing. The user must be able to  click on the drawing (for selection). TStatic does the
job, except for the MouseInput

So my question is: How to get TStatic to accept MouseEvents?

.Luc.
0
Comment
Question by:LucHoltkamp
  • 3
  • 3
6 Comments
 
LVL 4

Accepted Solution

by:
md041797 earned 80 total points
ID: 1163234
Derive a new class from TStatic.
In your dialog give the frame an id other than -1.
Check the notify parent box.
Use a response table entry for your mouse event.
Make sure you call SetupWindow for TStaic if you override this member.
0
 
LVL 3

Author Comment

by:LucHoltkamp
ID: 1163235
The 'parent-notify' was the missing link. I do not understand the logic of it though. It's a frame-flag and according to the help it means that the frame sends it parent (The TStatic?) messages (STN_CLICKED, etc..) when it is clicked. It says nothing about enabling mouseevents.
Could you tell me more about it??
0
 
LVL 4

Expert Comment

by:md041797
ID: 1163236
It forces the static control to send STN_ENABLE to the dialog box.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Author Comment

by:LucHoltkamp
ID: 1163237
What is the connection between STN_ENABLE messages and mouse-events? STN_ENABLE isn't even used by OWL (as far as I know) so I assume it's Windows Internal. Also: the STN_ENABLE is send to the dialog. How can the dialog affect the TStatic to accept mouse-events. Whats the mechanism behind all this? Can you enlighten me? Thanks,
.Luc.
0
 
LVL 4

Expert Comment

by:md041797
ID: 1163238
I got it backwards.
The dialog box sends STN_ENABLE to the static control on initialization. If the static control has the SS_NOTIFY sytle set, it will start accepting mouse and keyboard input after recieving this message.  This is similar to the regular WM_ENABLE message, but its new to Win95 and specific to a static control.


0
 
LVL 3

Author Comment

by:LucHoltkamp
ID: 1163239
Thanks, its more clear to me now.
.Luc.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now