Little Confusion with Bind Command for Panel is clicked

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Little Confusion with Bind Command for Panel is clicked

Post by Mungo1981 »

Dear Community,
As Everyday the same procedure.
I still standing on the tube, and I knew no way to do what I wont.

I have to bind the Left Click on my Mouse on a Panel, to call a Procedure.
So far I am:

Code: Select all

 TrackAmp->Bind( wxEVT_LEFT_UP, &TrackControl::OnGenTrack);
This Should:
1.) Bind the Command wxEVT_LEFT_UP,
2.) on the Panel "TrackAmp" to
3.) the Procedure TrackControl::OnGenTrack()

So in this Version it rains Error Messages, which I not understand.
And my Main-Question is:
1.) Must I Include some thing special to get Mouse_Events when other Events like Buttons are running.
2.) Has the call of the Procedure chatch any Parameters giving by this Bind
3.) What is the correct spelling on the Event: "wxEVT_LEFT_UP" or "wx.EVT_LEFT_UP". last spelling are listed in Python Code Examples

For any Help in Futuire
thanks of
Mungo1981
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Little Confusion with Bind Command for Panel is clicked

Post by doublemax »

So in this Version it rains Error Messages, which I not understand.
Please post the exact error message(s).

Code: Select all

TrackAmp->Bind( wxEVT_LEFT_UP, &TrackControl::OnGenTrack);
What is the type of "TrackAmp" and in which context is this called? Depending on the answers, the code might have to look like this (just a guess!):

Code: Select all

TrackAmp->Bind( wxEVT_LEFT_UP, &TrackControl::OnGenTrack, this);
1.) Must I Include some thing special to get Mouse_Events when other Events like Buttons are running.
No.
2.) Has the call of the Procedure chatch any Parameters giving by this Bind
Sorry, i don't understand the question.
3.) What is the correct spelling on the Event: "wxEVT_LEFT_UP" or "wx.EVT_LEFT_UP". last spelling are listed in Python Code Examples
For C++ it's wxEVT_LEFT_UP. If you use Python it's wx.EVT_LEFT_UP.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Little Confusion with Bind Command for Panel is clicked

Post by Mungo1981 »

Ok,
Thanks for the Ansers on Ponit 2.) and 3.)

To Point 1.):
This Bind is in a Constructor of a superordinate wxPanel.
The Typ of the Object before ->Bind is a wxPanel,
in Because of: It is the Panel which should letter process a Drawing Action. In moment it should display a Message that it has receive a Event of cliked with the Left Mouse Button this Panel.
I will give you a lissting on the Error in one Moment:
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Little Confusion with Bind Command for Panel is clicked

Post by Mungo1981 »

Hello back again.

Here I'm thinking are the Important Files:
The Errors
download/file.php?mode=view&id=5701
The Cpp Files with the most changes:
download/file.php?mode=view&id=5700
The corresponding .h File:
download/file.php?mode=view&id=5699
Attachments
Error.txt
(2.38 KiB) Downloaded 80 times
TrackControl.cpp
(3.89 KiB) Downloaded 90 times
TrackControl.h
(480 Bytes) Downloaded 82 times
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Little Confusion with Bind Command for Panel is clicked

Post by doublemax »

A mouse event handler must have this signature:

Code: Select all

void TrackControl::OnGenTrack(wxMouseEvent &evt)
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Little Confusion with Bind Command for Panel is clicked

Post by Mungo1981 »

Thank you Doublemax,
Now it runs all to my greatest success.

A very happy,
Mungo1981
in greatest thanks until the next stupid question :D =D> :D
Post Reply