topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 8:46 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Coolness [ switch to compact view ]

Pages: [1]
1
FARR Plugins and Aliases / Re: plugin/JS communication????
« on: July 16, 2009, 05:02 PM »
This is getting strange. I removed all MessageBox()s and alert()s. Without a timeout, it stalls at displaying 2, meaning the plugin receives pcommand twice and calls the js twice, but doesnt receive anything after that. If I change line 10 in the JS above to
window.setTimeout( function() { document.getElementById("link").click(); },1000);
I get the numbers every second, in this order: 2 6 14 30 62 126 254 696
So the first 1000 milliseconds it managed two hits, then 4 in the second, then 8 in the third, 16 in the 4th, 32 in the 5th, etc.
2^n? wtf

2
FARR Plugins and Aliases / Re: plugin/JS communication????
« on: July 16, 2009, 04:33 PM »
Ahh I thought pcommand was something you replace with your plugin name. Gotcha.

Unless I'm doing something wrong, this method of communicating via farr:// and Wb.ExecJavascript doesn't seem to be that robust. For example, a simple test page with
Code: HTML [Select]
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. var timesrun = 0;
  3. function runthis(str)
  4. {
  5.         timesrun++;
  6.         document.getElementById("link").innerHTML = ""+timesrun;
  7.         document.getElementById("link").click();
  8. }
  9.  
  10. <a id="link" onclick="location.href=this.href" href="farr://pcommand RETURN something">Send return signal</a>
  11.  
  12. </body></html>
And then in the plugin
Code: C++ [Select]
  1. BOOL MyPlugin_SetStrVal(const char* varname, void *val)
  2.         {
  3.         // farr host will pass us function pointer we will call
  4.         if (strcmp(varname,DEF_FieldName_NotifySearchCallbackFp)==0)
  5.                 callbackfp_notifysearchstatechanged = (Fp_GlobalPluginCallback_NotifySearchStateChanged)val;
  6.  
  7.         std::string s(varname);
  8.         if (s.find("pcommand",0)!=std::string::npos)
  9.         {
  10.                 MessageBox(0,"Received message from javascript. Calling js function.",varname,0);
  11.                 callbackfp_set_strval(hostptr,"EmbeddedWb.ExecJavascript","runthis('something')");
  12.                 return TRUE;                    
  13.         }
  14.         return FALSE;
  15. }
Then igo [the html page].
Click the link, and at least for me, the link sends the farr:// command 3 times, but the plugin only receives it twice, and the loop isn't infinite as it should be.

I tried adding a delay in case windows doesn't handle executing protocols quickly or something, but to no avail.

I have a backup method with an XMLHttpRequest object if the above method isnt possible, but before I give up with it, any suggestions?

3
FARR Plugins and Aliases / Re: plugin/JS communication????
« on: July 16, 2009, 10:57 AM »
right now I'm just struggling to set up some basic communication.
Say I set the mode to html, tell it to load a file. The html file contains an anchor to farr://sendthisstring. I click it, but no function in my plugin is called (I set up a messagebox on everything). Suggestions?
BOOL MyPlugin_SetStrVal(const char* varname, void *val)
{
   // farr host will pass us function pointer we will call
   if (strcmp(varname,DEF_FieldName_NotifySearchCallbackFp)==0)
      callbackfp_notifysearchstatechanged = (Fp_GlobalPluginCallback_NotifySearchStateChanged)val;
     MessageBox(0,varname,"",0); //nothing about farr:// being clicked.
   return FALSE;
}

4
FARR Plugins and Aliases / Re: plugin/JS communication????
« on: July 12, 2009, 01:31 AM »
I should also ask...is there a maximum buffer for the JAVASCRIPT CALL TO MAKE?? say I want to send a huge string....
Or the return value?

5
FARR Plugins and Aliases / plugin/JS communication????
« on: July 12, 2009, 01:12 AM »
Hi all,
I know that a plugin can call "EmbeddedWb.ExecJavascript, JAVASCRIPT CALL TO MAKE" and can receive the immediate result via ExecJavascriptResult, but is it possible for a plugin to also receive a farr://string ?

Pages: [1]