15,918,808 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Patty7 (Top 5 by date)
Patty7
1-Feb-13 6:17am
View
Deleted
This is the same MyPanel.cpp code, written in wxWidgets and ran in Windows and Linux. I don't have an special "Windows" code, I ran this same code in Windows and I catch the event.
You can google this "When a child window is disabled, Windows passes the child's mouse input messages to the parent window".
Or read here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632599%28v=vs.85%29.aspx "When a child window is disabled, the system passes the child's mouse input messages to the parent window"
What I am trying to do is: Add a child window like wxTextCtrl and being able to configure/drag/resize/overpaint when in "editable mode", and let it do its own behavior when in "run mode". So "disabling" the control temporarily is convenient, and worked fine when running it in Windows. Not sure why it works, I assumed because it says in Windows "When a child window is disabled, the system passes the child's mouse input messages to the parent window", but maybe there is something else that is affecting and I don't know.
What part of the code you want me to show. The frame that has the panel? I copied the "pWnd3 window" sample because I was able to reproduce it with this simple test. I also tested by adding the table event directly to my wxApp and catch the event there, and the same happened, the event is caught while running it in Windows, but not while running it in Linux.
Patty7
31-Jan-13 16:24pm
View
MyPanel.h:
MyPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL|wxCLIP_CHILDREN);
MyPanel .cpp :
========
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_LEFT_DOWN(MyPanel::OnMouseLeftDown)
END_EVENT_TABLE()
=========
MyPanel::MyPanel(wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style, title)
{
wxWindow *pWnd3 = new wxWindow(this, wxID_ANY, wxPoint(220,220), wxSize(100, 100));
pWnd3->Disable();
}
void MyPanel::OnMouseLeftDown(wxMouseEvent &event)
{
// when running in Windows of course the event.Object is the MyPanel window as I expected.
int ltest;
ltest = 1;
}
If I set a break point on the OnMouseLeftDown method.
if I run the program and click on the child window area on the screen, in Windows it hits the break point, in Linux it does not.
Thank you.
Patty7
31-Jan-13 15:31pm
View
Thank you for your time. I have exactly the same wxWidgets code. When I run it in Windows, I get the event in the parent window when I click on a disabled window. When I run it in Linux the parent does not get the event.
Patty7
31-Jan-13 14:45pm
View
I tested in Windows, and it does work fine in Windows.
From Windows documentation:
"Messages : The system passes a child window's input messages directly to the child window; the messages are not passed through the parent window. The only exception is if the child window has been disabled by the EnableWindow function. In this case, the system passes any input messages that would have gone to the child window to the parent window instead. This permits the parent window to examine the input messages and enable the child window, if necessary"
Patty7
31-Jan-13 13:58pm
View
What I really have is a wxPanel, with my wxWindow derived class children, let's call it "Class1".
"Class1" is serves as a base class for any window with any type of Control in it, for example a wxGrid or wxTextCtrl, or my own painted window.
My Class1 handles all mouse events for any type of child windows derived from it, it also allows me to overpaint whatever I want over the controls. It handles all the drag, resize, overpaint, etc.
When I switch my "Class1" window to "configurable" mode, the control is disabled and I can drag, move, resize, and overpaint in Windows.
I did not want to use bitmaps on painting, resizing, etc, for several reasons, but if this is the only way I guess I will need to do it. I was thinking that there could be a way like in Windows, to pass the keyboard input messages to the parent when the window was disabled. This works fine in Windows, but not in Linux.