Hello Jordi,

JS execution specified with doJavaScript() is delayed until after
loading the scripts specified in 'require' statements. What is
possible, is that the line with wApp->doJavaScript is maybe executed
too early?

For that reason, it is usually better to use the doJavaScript() method
of the particular widget that you intend to update, so in this case:
            m_editBox->doJavaScript(
                        "jQuery(function() { jQuery('.wymeditor').wymeditor("
                        "    { "
                        "        updateEvent:\"mousedown\", "
                        "        logoHtml: '' "
                        "    }); });" );

It would be even better if you could pass the m_editBox->jsRef() to
the wymeditor call to specify which widget has to be 'wymeditorified'.

Hope this helps,
Wim.

2012/6/16 Jordi Rovira <[email protected]>:
> Hi again,
>
>   I have started to use WYMEditor in my WT site. I had some problems using
> it and the final solution has been to use it in a dialog and to call this
> every time i create such dialog:
>
>         {
>
>             wApp->require( "/res/wymeditor/jquery/jquery.js" );
>
>             wApp->require(
> "/res/wymeditor/wymeditor/jquery.wymeditor.min.js" );
>
>             wApp->doJavaScript(
>
>                         "jQuery(function() {
> jQuery('.wymeditor').wymeditor("
>
>                         "    { "
>
>                         "        updateEvent:\"mousedown\", "
>
>                         "        logoHtml: '' "
>
>                         "    }); });" );
>
>         }
>
>
>         m_editBox = new WTextArea( m_text, dialog->contents() );
>
>         m_editBox->setStyleClass("wymeditor");
>
>
>         // Buttons
>
>         WPushButton* ok = new WPushButton( "Save", dialog->contents() );
>
>         ok->setStyleClass("wymupdate");
>
>         ok->clicked().connect( boost::bind( &EditableTextBox::onEditAccept,
> this, dialog ) );
>
>
>
>
> I also call the fragment in brackets at the header of my site, to try to
> preload the javascript, which totals around 200kb.
>
> At first, i was doing the "require" calls once only, at the header which is
> present in all pages, This used to work well in local, but not when the site
> was deployed, since the scripts didn't seem to load (on time?). This makes
> me think i may not be understanding exactly what i am doing with the
> javascript load calls, so that's why i am asking here. Do you think this is
> the proper way to do it?
>
>   Regards,
>
> Jordi
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to