Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Getting Mouse Over notifications
No permission to create posts
February 24, 2016
4:07 am
Forum Posts: 44
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline


I'd like to track Mouse enter and mouse exit events on my controls (for mouse over helper text, display knob values, etc.).

VSTGUI has an IMouseObserver with onMouseEntered and onMouseExited, however, I am unable to get successful calls to either of those functions after implementing them. I have tried on both the main class derived from CPlugIn in my own project, as well as implementing them in VSTGUIController from the CustomViewsFive project.

I have verified that my Frames and Views have mouseEnabled.

I would appreciate any insights on how to proceed.


February 24, 2016
8:10 pm
W Pirkle
Forum Posts: 209
Member Since:
January 29, 2017
sp_UserOfflineSmall Offline

IMouseObserver is designed for, and implemented on the CFrame object (see both the VSTGUI docs and frame.h). To get mouse notifications at the frame level, subclass CFrame and then override/implement the functions in your derived class. You can do this in the VSTGUIController in CustomViewsFive. You need to subclass your own CFrame object and then set the member variable to your object in the open( ) method:

// --- construct the frame
frame = new CMyFrame(frameSize, this);

Then you catch mouse activity in your derived CMyFrame class.

However, CView also handles mouse notifications, indirectly through IMouseObserver via the frame. If you want to catch mouse activity at the control (CView) level, just subclass whatever controls you need notification for, then override/implement the mouse functions. See cview.h for the base class function prototypes.

You can easily test this by using the CustomViews project:

1) modify the CKnobWCP object by overriding the mouse functions in KnobWCP.h
2) implement the overridden functions in the KnobWCP.cpp file
3) un-comment the CKnobWCP instantiation in showCUI( ), and comment out the line above it:

// --- custom reverse version
CKnobWCP* pKnob = new CKnobWCP(rect, etc......

Then, you can set breakpoints in the mouse message handlers to catch and monitor the events for that knob.

So, the answer is to subclass your frame and/or view objects to catch the mouse events. This will depend on the level of mouse activity that you need to catch (frame vs. view).

- Will

February 25, 2016
5:21 am
Forum Posts: 44
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline

Thanks Will.

Upon further investigating I realized the frame needs to register the mouse observer. ( frame->registerMouseObserver(IMouseObserver *observer) )

This allows any class to extend IMouseObserver and be used as the observer, no need to subclass CFrame.

So in the CustomViewsFive project I just had VSTGUIController extend IMouseObserver, implemented the onMouseEnter() and onMouseExited() methods, then set the frame's mouse observer to VSTGUIController

// inside VSTGUIController.cpp

The onMouseEntered and onMouseExited provide the CView on what your mouse has moved over so I'll extend CView so that I can check when my custom control gets moused over and then access the extra stuff like tool tip text for that control.

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
2 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 48

Derek: 44

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

JimmyM: 29

EZB: 24

lppier: 23

Msaldaña: 18

Member Stats:

Guest Posters: 1

Members: 510

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 31

Topics: 527

Posts: 2038

Newest Members:

Matt, dspstudent, strings4v, TheSmile, semihyavuzz, alfredLue, danioc, midnightskate3, Alia5, Shamal Sundar

Moderators: W Pirkle: 209

Administrators: Tom: 67, JD Young: 80, Will Pirkle: 0, W Pirkle: 209