cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Mouse events in Creo Parametric API

ZS_10383889
10-Marble

Mouse events in Creo Parametric API

Hi again,

 

Once again the newbie question.

 

We want to develop an extension that depends on the ability to receive some basic info about the items clicked by our users (e.g. - id of the clicked element).  I see such info displayed by the system on mouse hover and on mouse click selection. Unfortunately, I did not found any documented API which notify me on this events.

Do I understand right that no hooks are provided by API on the mouse events? How do you solve this standard situation?

 

Thank you so much for your advise.

ACCEPTED SOLUTION

Accepted Solutions
remy
21-Topaz I
(To:ZS_10383889)

given the scenario you are after then @Eike_Hauptmann suggestion to use ProSelect is the solution. Once the selection is successfull dig in and get the information you need.

 

Then again Creo Toolkit offers thousands of functions that have been refined over decades.

Remember that feasibility is tied up to what is possible from the User Interface perspective. 
Possible does not necessarily mean available.

And finally: all functionalities do not necessarily have an API.

As developers,, we tend to think that APIs tap directly in the UI functionalities while an API is actually a door that has been purposefully created by R&D and simply that door sometimes is simply not there.

Reversely some developers who are less versed in using Creo and more in coding need to understand firstly what happens from the UI's perspective and refrain from simply rolling out the documentation.

This is the content of this article in a nutshell : https://www.ptc.com/en/support/article/cs324624 

View solution in original post

9 REPLIES 9

Hi,

 

you have two options ... you can use a triggered behaviour (if you want to have a parallel opened Dialog). Or you can use an explicit Select (Toolkit Select 🙂 ). So people acitvate your function and select the element from the type you have defined (e.g. feature).

 

Both are possible ... as triggered you can use uifcDialogListener in OTK or ProNotificationSet in TK.

 

Be aware that the triggered functions get called more often than you want so you need to strip that down and it slows your Creo. So if possible I would recommend the use of the Select option. (TK - ProSelect, OTK - pfcSession->Select)

 

Br,

Eike

Eike, thanks a lot for your answer.

 

I need the event to be reflected in the dialog so the "triggered functionality" matches it.

I found now uifcDrawingAreaListener::OnLeftMouseDown(); Probably that what I was looking for. Not sure yet what is a "Drawing Area".

 

Kudos and BR

 

 

What Remy says !

 

A Drawing Area is a Dialog Element where you can draw in ... it's also inside the main Creo Dialog where the CAD Model is shown.

 

I wouldn't recommend to put things directly on these listeners because they would be called often. So the way with the select is the best option you have under respect to your system resources.

 

Br,

Eike

remy
21-Topaz I
(To:ZS_10383889)

When it comes to the mouse interaction you need to be exhaustive about the event that you are looking for.
What exactly do you mean by  "the ability to receive some basic info about the items clicked by our users "?


Mouse interaction implies hovering, Right Mouse Button, Left Mouse Button, movement and so on. 

EIke suggestion is the selection consquently this function is about when LMB on something in the graphics window.

The more exhaustive the events you need and the easier it will to make suggestion.

I have to reckon that when searching "mouse" in the documentation only 3 functions are listed though.

Hi Remy,

 

Sorry for not being specific enough. Let's consider a possible scenario:

 

1. The program will present some model (either assembly or part), which has several surfaces.

2. The user will click on one of the surfaces (Left Mouse Button).

3. I want to receive this event and be able to identify the surface selected (left mouse clicked) by the user. 

 

"I have to reckon that when searching "mouse" in the documentation only 3 functions are listed though". - That is exactly what worries me!

Thanks for your reaction. 

BR - 

remy
21-Topaz I
(To:ZS_10383889)

given the scenario you are after then @Eike_Hauptmann suggestion to use ProSelect is the solution. Once the selection is successfull dig in and get the information you need.

 

Then again Creo Toolkit offers thousands of functions that have been refined over decades.

Remember that feasibility is tied up to what is possible from the User Interface perspective. 
Possible does not necessarily mean available.

And finally: all functionalities do not necessarily have an API.

As developers,, we tend to think that APIs tap directly in the UI functionalities while an API is actually a door that has been purposefully created by R&D and simply that door sometimes is simply not there.

Reversely some developers who are less versed in using Creo and more in coding need to understand firstly what happens from the UI's perspective and refrain from simply rolling out the documentation.

This is the content of this article in a nutshell : https://www.ptc.com/en/support/article/cs324624 

Thanks a lot for your help.

BTW, off the topic, do you have instructions of how to debug extension code in Visual Studio?

remy
21-Topaz I
(To:ZS_10383889)

You need instructions on how to debug a Creo Toolkit application and this is a fair request as debugging can be instrumental in your development.

I'm sad to inform that VS being a third party application this is beyond my scope.


Nonetheless you will find some information in the knowledge base (although scarce given our scope) and feel free to file a new topic about it. I'm sure other users will happily share their instructions.

FV
17-Peridot
17-Peridot
(To:remy)


@remy wrote:

given the scenario you are after then @Eike_Hauptmann suggestion to use ProSelect is the solution. Once the selection is successfull dig in and get the information you need.

 

 


successful selection event is not necessary.

pre-selection (and post-selection) function pointers  which are in the parameter list of ProSelect(...) function will hook up mouse-over events.

HIH.

Announcements


Top Tags