Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 738
    • Issues 738
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 202
    • Merge requests 202
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #17784

Closed
Open
Created Feb 13, 2020 by Flaviu_@mesajflaviu

vtkDistanceWidget bug

I am using VTK 8.1, in Windows 10 64 bit, VS2017 environment.

I have written the following code:

	void CVTKDoc::CreateDistanceWidget(CVTKView* pView)
	{
		// Associate the widget with the render window interactor
		vtkDistanceWidget* pDistanceWidget = vtkDistanceWidget::New();
		pDistanceWidget->SetInteractor(pView->m_pInteractor);
		// Create the default widget representation and set the label format
		pDistanceWidget->CreateDefaultRepresentation();
		static_cast<vtkDistanceRepresentation*>(pDistanceWidget->GetRepresentation())->SetLabelFormat(_T("%-#6.3g mm"));
		// Allow the observer to access the widget
		vtkCallbackCommand* pCallback = vtkCallbackCommand::New();
		pCallback->SetClientData(pDistanceWidget);
		pCallback->SetCallback(&CVTKDoc::DistanceWidgetCallback);
		pDistanceWidget->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent, pCallback);
		pDistanceWidget->On();
		pCallback->Delete();
	}

and the static method:

void CVTKDoc::DistanceWidgetCallback(vtkObject* caller, long unsigned int eventId, void* clientData, void* callData)
{
	vtkDistanceWidget* pDistanceWidget = (vtkDistanceWidget*)clientData;
	TRACE(_T("%d\t%p\n"), (static_cast<vtkRenderWindowInteractor*>(caller))->GetKeySym(), pDistanceWidget);
	if (pDistanceWidget)
	{
		TRACE(_T("Good: clicked on the distance widget\n"));
	}
	else
	{
		TRACE(_T("Error: clicked something else\n"));
	}
}

This is the image:

Untitled

Now, EVERYWHERE I click on image, I see "Good: clicked on the distance widget" ... I mean, everywhere. Even if I put over the image another widget, let say text widget, and I click on that text widget, I see the same message from the distance widget. Which is not normal. That is why I reported a bug. Please correct me if I wrong.

Edited Feb 13, 2020 by Flaviu_
Assignee
Assign to
Time tracking