hook WTextEdit events
Added by Mark Petryk almost 4 years ago
I am trying to 'hook' a WTextEdit event, and get a signal sent back to Wt. I have never worked with JSignal or anything, so I'm a little bit off the range here, any help is appreciated.
I would like to signal Wt anytime a key is pressed in the tinymce editor. I have this code so far and it works;
3298 m_textEdit->·
3299 rendered().connect( [=]()·
3300 {·
3301 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;·
3302 ·
3303 auto js =·
3304 Wt::WString::tr( "textedit.js" )·
3305 .arg( m_textEdit-> jsRef() )·
3306 .toUTF8()·
3307 ;·
3308 ·
3309 std::cout << __FILE__ << ":" << __LINE__ << " " << js << std::endl;·
3310 ·
3311 Wt::WApplication::instance()-> doJavaScript( js );·
3312 ·
3313 ·
3314 });·
3563 <message id="textedit.js">·
3564 <![CDATA[·
3565 {1}.ed.onKeyPress.add( function() { alert('blur'); } );·
3566 ]]>·
3567 </message>·
src/Dbo/JobEditor/JobEditor.cpp:3301
src/Dbo/JobEditor/JobEditor.cpp:3309
Wt4_2_1.$('o9nps4d').ed.onKeyPress.add( function() { alert('blur'); } );
What I would like to do is, instead of opening an alert in the browser, I would like to send a signal back to Wt so my server knows a key has been pressed on that widget. Can someone guide me to getting a signal back from the browser?