How do I override vendor package method to place my event trigger there? I would like to register an event for a vendor package method. How should I do that?
Let say user registered event. I researched in web, i saw some got using auth.login hook, but that is because the login package itself been fire that event, we just create the listener part.
Related
I am using Delphi XE2 and Chromium CEF4Delphi. I am trying to use a web page via the TChromiumWindow component and would like to detect when an element is selected / clicked.
I saw this post..
Delphi Chromium - launch a command in Delphi application when button in web page is clicked by user
Unfortunately, I cant find the function AddEventListenerProc in the CEF4Delphi library. Neither can I find an alternative way to monitor a button / element click.
I would like to use the TChromiumWindow component to act as a "fron-end" to my app and would like to monitor user button clicks etc.
Can anyone help please ? I did try the developer forum but I dont see much activity there and was unable to register.
Many thanks..
The DCEF3 project has a group here : https://groups.google.com/forum/#!forum/delphichromiumembedded
But the CEF4Delphi and OldCEF4Delphi projects have a developers forum here :
https://www.briskbard.com/forum/
That forum has new posts almost every day and I try to answer them as soon as I can, usually in less than 24 hours.
If you have problems creating an account just send me a message and I'll activate your account manually.
The link you posted is very old and many things have changed in CEF since 2012.
There are several ways to detect when a HTML element has been selected, clicked, etc.
You can use a JavaScript event like "onclick" that calls a custom JavaScript extension. That extension would send a process message to the browser process to notify that the user clicked that element.
You can also use the GlobalCEFApp.OnFocusedNodeChanged that is triggered when an HTML element has been focused. This event is executed in the "render" process so you will also need to send a process message to the main browser process that the focused element has changed.
Use the JSRTTIExtension or the JSExtension demos as a template for your app.
They show you how to set a "mouseover" event that calls the "myextension.mouseover" function defined in a custom JS extension. The myextension.mouseover function executes Delphi code and sends a process message to the main browser process with some HTML information that is shown in the status bar.
They also have an example for a "MutationObserver" that calls a generic "myextension.sendresulttobrowser" function in the JS extension that sends the "value" attribute to the browser process.
Build the demo and right-click on the web page when it's fully loaded. Then select the "Set mouseover event" or "Add mutation observer" options to test what I described.
I'm using DTM to implement Adobe Analytics code on a single page app.
I have a link that we've set up successfully as an exit link and it fires as it should. If this matters, it opens in a new tab and we don't actually exit the website. However, any time we fire off any subsequent page views, we see the same event fired. Is there any way to fire off this event only when the link actually is clicked? I assume that because it's a one page app and the code isn't getting refreshed that is the reason it's on every subsequent page.
Using Adobe Analytics and DTM is frustrating with single page apps. What we do is clear all the variables that are set before each page view. We have a function that clears, props, evars, events, listVars, heir, pageName etc.
Please check witch version of s_code you are using, if you are using Appmeasurement or one of the last s_code versions please use clearkVars() function.
following code is a log from browser console with console responses:
s.events ="event1"
"event1"
s.linkTrackVars='events';
"events"
s.eVar1="value"
"value"
s.clearVars();
undefined
s.events
undefined
s.eVar1
undefined
you can fire this in custom code section (if your custom code section is set to fire after gui settings, or you can fire it as JavaScript 3rd party tag.
I'm using the native Facebook Titanium module and I have the following issue.
In my app, you can login to FB from two different windows.
In the first one, I instatiated the module and added to the module a 'login' listener.
In the second window I did the same, I instantiated the module and added a 'login' listener.
Problem is the following: the second addEventListener doesn't overwrite the first (it looks like the second Facebook 'require' is simply a pointer to the module instantiated in the first window).
So, it happens the following: when I try to authorize the user and I enter the login listener, it turns out I'm always calling the first one, not the second (the second never gets called).
I tried to remove the first eventListener with no luck. Moreover, they 'live' in distant windows and it seems there's no way to remove this listener correctly.
Any help is appreciated,
Iannis
I hope this will clarify what you are seeing:
It's standard CommonJS behaviour that modules are cached and the second and following require() will get you a reference to the first instance.
Like the name says addEventListener adds an event listener and does not replace one added earlier.
You should get the login event twice, once for each event listener you add. I can't tell why it doesn't do that for you without further insight in your code.
I use c++buider4 and TWebBrowser. How can I avoid "mailto" to be executed when this type of link is clicked? Actually, I dont want this link to be executed because when it's executed, it switch to mail application and open a new windows.
Thanks
Use the OnBeforeNavigate2 event to cancel the operation if the URL being requested starts with mailto:.
I'm writing an Outlook AddIn which is supposed to offer a new special folder which the user can drag mail items into, in order to have them processed by the AddIn.
Now I'd like to be informed whenever the user tries to do that; but before it happens. However, there does not seem to be a way to do that.
Using the folder's BeforeItemMove event, Outlook informs me when the user tries to move an item out of the folder - but there is nothing like a BeforeItemAdd event.
The one thing that comes close is the ItemAdd event of the folder's items collection, but that one fires after an item has been added; at that time, the operation has already been completed. I see no way to tell where the item originally came from or (unlike the BeforeItemMove event) to cancel the operation in case the AddIn determines that it is not valid for some reason.
Theoretically, I should be able to add a BeforeItemMove handler to all the other folders and react to them whenever the move target is the folder managed by my AddIn, but that seems like a bit of overkill... isn't there an easier way?
Can't do that, all MAPI events are asynchronous and fire after something happens.
Outlook does fire some UI evenst synchronously (like BeforeItemMove), but there is nothing like BeforeItemAdd.