Hi Long,

The annotation is an integral part of the document view rendering cycle.

So you can define the string you want to use for annotation in e.g. here:

void a2dSelectTool::GenerateAnotation()

It will be rendered in:

void a2dStTool::RenderAnotation()

Run sample "sample_canvas_simple", and put a breakpoint on thee function, and 
look at the stack.

As you see a2dSelectTool::GenerateAnotation() also calls, which makes sure old 
and new position/area 
of annotation is redrawn.
a2dStTool::AddAnotationToPendingUpdateArea();

In general best take one of these tools (take the simplest one that fits your 
need), and make a 
copy, and make that copy do what you want.
As you later mails, derive, but that is not worth the trouble, better copy.

a2dPropertyTool
a2dDeleteTool
a2dSelectTool

The SetEventhandler approach is more to reuse all the tools, in a little 
different manner, so not 
right now for you.

In the same sample menu=> Demoscreen => doc0 you can hover over objects and see 
properties appear, 
which is a different system, but might fit your needs also. There is one more 
property in 
a2dCanvasobject, PROPID_TipWindow, that might be good for you.

Regards,

Klaas


On 10/09/2013 06:53 AM, pang long wrote:
> Dear Klaas
>    Could you please tell how to show user-defined annotation when click
> on one element of graphics in wxart2d?
>    My object is to show a annotation when I click one element of graphs
> shown by wxart2d. The annotation information is computed with respect to
> the clicked element.
>    The followings are what I have done and what problem I encountered.
>    I created and added a2dSelectTool to a2dStToolContr. I also created my
> own defined event handler by a2dSelectTool's SetEvtHandler. Its purpose
> is to handle the select change event. When it receives the event, it
> retrieves the selected elements from top element by CollectObjects. Then
> I compute the needed information for this selected element. I want to
> show the information in an annotation. So inside the event handler I
> invoked the following method:
> m_controller->GetDrawingPart()->GetDrawer2D()->DeviceDrawAnnotation...
>     But it reported run-time error that
> ....../wxArt2D/packages/wxart2d/artbase/src/dcdrawer.cpp(2316): assert
> "m_renderDC" failed in DeviceDrawAnnotation(): no renderDc set
>     Could you please tell me hints to solve this problem?
>     Is it better to create my own tool inherited from a2dSelectTool?
>     The drawing mechanism of wxart2d is quite complex for me. I guess I
> mistake the render method.
>    
> Yours
> Faithfully
> Long
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> _______________________________________________
> Wxart2d-users_dev mailing list
> Wxart2d-users_dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev
>


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to