Id for canvas tag

Added by Edward Hill over 1 year ago

Hello,
Wt generate they own id for html tag canvas:
<canvas id="co2e" height="400" width="400"></canvas>
How can I set my ID?


Replies

RE: Id for canvas tag - Added by Koen Deforche over 1 year ago

Hey Edward,

It is "c" + paintedwidget->id().
You can set your a custom id for a painted widget using WWidget::setId().

You should also realize that on IE no canvas is used.

Regards,
koen

RE: Id for canvas tag - Added by Edward Hill over 1 year ago

Thanks, it's works.
Can I switch off prefix `c` ? Or it's impossible?

RE: Id for canvas tag - Added by Koen Deforche over 1 year ago

Hey Edward,

No, because the canvas is actually contained in another div which also (optionally) includes image map elements which is given the actual id(). Something is thus needed to avoid duplicate ids.

Regards,
koen

RE: Id for canvas tag - Added by Edward Hill over 1 year ago

Ok, thanks!