Always use dynamic_cast to upcast. dynamic_cast will return 0 if the
object is of the wrong type. I believe this should work:

WString tableText = dynamic_cast<WText
*>(table->elementAt(0,0)->widget(0))->text());

Wim.

2010/11/17 Magnus Arntzen <[email protected]>:
> Hi.
>
> When I create a WTable and fill it with text, is it possible to access
> that text again?
>
> ex:
>
> WTable *table = new WTable(this);
> new WText("Hello World!", table->elementAt(0,0));
>
> WString tableText = table->elementAt(0,0)->text(); //WOULD BE NICE IF
> THIS WORKED
>
> I tried casting the WTableCell to WInteractWidget and further to WText,
> but dereferencing text() causes run-time error.
>
> Is there a way to do this?
> (this is for printing/exporting table contents)
>
> Thanks!
>
> -Magnus
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to