Jump to content
Developer Wiki and Function Reference Links ×

How to draw temporary text from a tool ?


Cmb

Recommended Posts

Dear SDK experts, 

 

We struggle to draw temporary text from one of our tool.

Based on an old post on this forum, and answer from Hippocode there,

we try to draw a temporary text block using this piece of code, but nothing happens. The same example is working fine with basic obj types such as 2d line or 3d polylines, but impossible to get a temporary text from a kTextNode.

 

::Draw(IToolDrawProvider* draw_provider)
{
	if (context_.state == ToolContextData::kProcessState)
	{
		VectorWorks::IToolInteractiveDrawPtr tool_interactive_draw;
		gSDK->GetCurrToolInteractiveDraw(&tool_interactive_draw);
		if (tool_interactive_draw)
		{
			VWTextBlockObj text_block(tool_interactive_draw->GetObjectW(kTextNode));
			text_block.DeleteText();
			text_block.AppendText("10000");
            // for example tool_interactive_draw->SetObjectTransform() based on mouse
			tool_interactive_draw->UpdateObject(kTextNode);
		}

		WorldCoord perspective_distance, clip_distance;
		WorldRect redraw_r;
		gSDK->GetPerspectiveInfo(gSDK->GetActiveLayer(), perspective_distance, clip_distance, redraw_r);
		gSDK->RedrawRect(redraw_r);
		this->UpdatePreview();
	}

 

We also tried to pre-allocate textblocks and then display / move / delete them from Draw or MouseMove functions, but it didn't displayed well.

 

Is there any way to draw any kind of text while the tool is active ? 

 

Thank you for your answers

 

Have a good day!

 

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.

Guest
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...