Solved

TStatic needs MouseEvents

Posted on 1997-05-03
6
286 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
why "." vs "->" 23 120
C++ finding a sting in a char* string from a text file 3 108
thread-safe code in c++ 2 101
How to convert MFC::CString to UTF8 wchar_t* 10 206
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 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