On 16 oct, 14:40, zhiweiv <[email protected]> wrote:
> i want to use SyntaxHighlighter(site:http://alexgorbatchev.com/wiki/
> SyntaxHighlighter)  to highlight code , the offical demo is
>
> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
>     <head>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8" />
>         <script type="text/javascript" src="scripts/shCore.js"></
> script>
>         <script type="text/javascript" src="scripts/shBrushJava.js"></
> script>
>         <link type="text/css" rel="stylesheet" href="styles/
> shCore.css"/>
>         <link type="text/css" rel="stylesheet" href="styles/
> shThemeDefault.css"/>
>         <script type="text/javascript">
>             window.SyntaxHighlighter.all();
>         </script>
>     </head>
>     <body>
>         <pre class='brush:java'>public String getName();</pre>
>     </body>
> </html>
>
> it works well. now i want to use it in gwt ,my code is
>
> public class MainEntryPoint implements EntryPoint {
>     public void onModuleLoad() {
>         sh();
>         RootPanel.get().add(new HTML("<pre class='brush:java'>public
> String getName();</pre>"));
>     }
>     private native void sh()/*-{
>         $wnd.SyntaxHighlighter.all();
>     }-*/;
>
> }
>
> but is seems doesnt work at all.   does anyone can give me some
> ideas?

Because $wnd.SyntaxHighlighter.all() registers a window.onload event
handler, which generally already happened at the time onModuleLoad is
called. Try calling $wnd.SyntaxHightlighter.highlight() instead.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to