Jump to content
Developer Wiki and Function Reference Links ×

Parametric Custom Control Points

Maarten DE

Recommended Posts

You can handle creation/deletion/position as mentioned on that page. Depending on how flexible this should be I do this on kobjectCreated event or in the recalc event.


But for managing the images, displayed hover text and other specific actions I advice to use the IProviderCursorHandles interface. This also replaces the old code you mentioned. The interface will catch these events.

Edited by Hippocode
  • Like 1
Link to comment

Thanks Wouter, the creation of the control points works now.


A question: is it possible to have a custom data bar while dragging a custom control point?


I tried this in a overwrite of VWParametric_EventSink::OnCursorEvent( ParametricMessage* message ),  case message->fAction = ParametricCursorMessage::EAction::kAction_MouseDown:

                CustomBarRefID outCustomBarRefID;
                bool b = false;
                b = gSDK->CustomBarCreate( 1, outCustomBarRefID );
                b = gSDK->CustomBarInstall( outCustomBarRefID );
                CustomBarFieldInfo fieldInfo;
                fieldInfo.fFieldLabel = "Length";
                fieldInfo.fFieldValue = 1000;
                fieldInfo.fIsEditable = true;
                fieldInfo.fIsLocked = false;
                b = gSDK->CustomBarSetFieldInfo( outCustomBarRefID, 0, fieldInfo );
//                b = gSDK->CustomBarRelease( outCustomBarRefID );

It still shows the default data bar but all values are empty. When I don't use gSDK->CustomBarRelease() (because it returns false) the data bar values are still empty, except the first (X) has a reversed S in it...


I tried the same in and overwrite of IProviderCursorHandles::OnCursorAction_MouseDown( ICursorHandleActionContext* context ) but that one doesn't even get hit (even when I remove the overwrite of VWParametric_EventSink::OnCursorEvent( ParametricMessage* message )).


This doesn't work either.

TXString lab = "Length";

gSDK->SetDataDisplayBarField( 0, barLength, lab );
gSDK->SetDimUserBarValue( 0, 1000 );


In the VWTool_EventSink class, I found these functions, but I don't think I should use them because the Control Points are part of the object, not the tool. Also, when I implement them, they don't get hit.

			virtual void			OnCustomBar_Setup();
			virtual void			OnCustomBar_Setdown();
			virtual void			OnCustomBar_UpdateValues();
			virtual void			OnCustomBar_LockValue(size_t fieldIndex, const TXString& userString);
			virtual void			OnCustomBar_UnlockValue(size_t fieldIndex);
			virtual void			OnCustomBar_LockValue(const CustomBarLockValueData& lockData);
			virtual void			OnCustomBar_UnlockValue(const CustomBarLockValueData& lockData);


Did anyone got this to work in their PIO?

Link to comment

I'm using the CParametricCustomBar wrapper class instead.

This example comes from a cursor event that shows and allows to change the angle between two lines.


I initiate it on OnCursorAction_MouseDown on first click

            fAngleBar.SetFieldLock(0, false);


On any other click, within the same function I close it because what I was doing has completed.



while mousemove I modify the value to match the situation:

        gSDK->CustomBarSetFieldAngle(fAngleBar.GetCustomBarID(), 0, Utility::GetAngleBetweenVectors(-V1, VDir));


Edited by Hippocode
  • Like 2
Link to comment

Thanks again 🙂 .


I did notice that in IProviderCursorHandles, all the OnCursorAction_ ... and OnCustomBarEvent functions only get hit when clicking/hovering/... over parameter control points, not the dynamic created control points. Strangely enough, the GetHandle... functions of that class do get hit when clicking/hovering/... over dynamic created control points. Has anyone notice the same thing?

Link to comment

Think of the OnCursorAction triggers as a tool, you need to start it before the others will be triggered. And it starts with triggering a controlpoint by clicking/hovering it I guess.

The other functions just show the images and text and decide if they should be visible, those are triggered constantly probably.


I believe non parametric control points have positive index values, parametric ones negative. you can mix the use of them but it's important to return true/false properly @ IsDefaultCursorHandled

Sint32 Index = context->GetCustomPtClientID(); // Index of CP


I believe there are a lot of inconsistencies in those interfaces. For me I know that ICursorHandleActionContext::GetObject not always returns the effective object (or didn't in the past). For that reason I keep a copy of the handle in the interface itself and update it whenever GetObject does return a value in any of those functions. This ensures the other functions know which object we are managing the controlpoints for regardless of the provided context.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...