Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OnPermissionRequested from Powerbuilder
I've been happily using AntView version 1.0.111-2 with Powerbuilder for a project and it's been working absolutely perfectly.

I recently tried using it for a second project which accesses a different website. Everything worked fine, except I kept getting messageboxes pop up from the website requesting permission to access generic sensors. It didn't matter whether I clicked allow or deny, once I'd got rid of the messagebox, everything worked fine and the website functioned as normal. However, I wanted to automate the process, so I needed a way to automatically deal with these permission requests.

I noticed the newer version 1.1.174 of AntView has a new event OnPermissionRequested, which I thought I could use to trap and handle these events, so I installed the newer version.

Unfortunately, this event doesn't appear to fire. On accessing the website, instead of getting any permission messageboxes at all, the website seems to sort of hang. Although some basic functionality on the website works, none of the links work and any further navigate commands don't work.

Going back to basics, I tried accessing the website from the example Web Browser Demo application, with the same result - you can access the website, but then none of the links work and you can't navigate to another web page.

The website is

Is there something stupid I'm doing wrong? Is there perhaps a flag to enable the OnPermissionRequested event that I have to set?

Any assistance would be greatly appreciated.

Many thanks,
Hello David,

When I tried to visit the site from down here, it did not trigger any permission related popups for me.
Might be that that is region specific.

However I just looked in my list of open support issues and there is a known support issue around permission requests.
The State variable returns invalid data and unless you set that to something valid (such as 1) it will block ongoing navigational requests. I will look at that today to see if I can figure out what is happening here.
FWIW, one could see this with a site such as (search "Zoek voor Plaats of Postcode" gives an option to use GPS)

re. the event not firing.
I'm not sure why you are seeing that. It certainly does fire here.
One thing I noticed with PowerBuilder that you have to remove the control and add it fresh in order for it to see new events.
For details see:

and in particular this bit:

Quote:Using events of the ActiveX control

An ActiveX control has its own set of events, which PowerBuilder merges with the events for the custom control container. The ActiveX control events appear in the Event List view with the PowerBuilder events. You write scripts for ActiveX control events in PowerScript and use the Object property to refer to ActiveX control properties and methods, just as you do for PowerBuilder event scripts.

The only difference between ActiveX control events and PowerBuilder events is where to find documentation about when the events get triggered. The ActiveX control provider supplies the documentation for its events, properties, and functions.

The PowerBuilder Browser provides lists of the properties and methods of the ActiveX control. For more information, see OLE information in the Browser.
New versions of the ActiveX control

If you install an updated version of an ActiveX control and it has new events, the event list in the Window painter does not add the new events. To use the new events, you have to delete and recreate the control, along with the scripts for existing events. If you do not want to use the new events, you can leave the control as is -- it will use the updated ActiveX control with the pre-existing events.

More details later once I had a chance to debug this for a bit and see what is happening.
Very many thanks for the quick reply, Wil.

I tried again using with the web browser demo and I get similar results. The website loads up fine and at first I can click on links as normal. But as soon as I go to the "Zoek voor Plaats of Postcode" box and click on the "Bepaal met GPS" link, the same thing happens. Links no longer work and typing a new URL into the address bar and clicking "Go" does nothing.

I'd already uninstalled and reinstalled the ActiveX object to get the new events. Within the event, I've tried some code to display the received parameters, a line of code to just beep when the event is fired, and also the simplest possible code to try to return a valid result (ie just "state = 0" and "state = 1"). Nothing seems to change the behaviour of the application. If I set a breakpoint within the code on that line, it doesn't get hit.

Incidentally, I've tried this on two separate machines, one running the latest version of Powerbuilder (Version 2021, build 1506) and one running a slightly earlier version (Version 2019 R2, build 2353). Both display the same behaviour.

I've also tried building the application into an executable, in case it was something to do with running in the development environment, but that made no difference.

Hope this additional info helps with your debugging.

Many thanks again for the help with this.

Kind regards,

There was a bug ... and on top of that Microsoft changed the interface and added a new parameter Handled.

The new parameter was added to the parameter list asĀ  I don't think many developers used the OnPermissionRequested event yet.

The AntView control however does not currently support the Handled parameter yet.
In order to be able to add support for it I would have to make too many changes due to it only having been introduced in WebView2 version 1.0.1185.39. The implementation for the Handled parameter will arrive in AntView version 1.2.x (soonish)

The bug you bumped into was with State and that has now been fixed.
There was also a possible code path that could prevent the event from getting triggered. I'm not entirely convinced that it was what prevented the event from working on your end, but we will see. If it still does not trigger then there is additional logging for us to see what happens.

I will email you a link to a private build of the control by email.

Hi Wil,

I downloaded and plugged in the new OCX and it worked perfectly first time. It's no problem to wait for version 1.2.x - now I know the application works, I can do a bit of tidying up and wait for the new version before implementing it.

I cannot thank you enough for such quick and excellent response to my problem. It's highly impressive to get such good support.

Many thanks again,

You can actually handle the popup already without the specific implementation of the new "Handled" parameter.
If the event triggers then you only need to change the value of the variable State.

Changing the value for State to anything else as the default then the WebView2 control will no longer issue the popup.
At least it didn't popup anything anymore in my tests.

Leaving the default will trigger the prompt, setting it to anything else makes it "Handled".

Where Allow = 1 and Deny = 2.

That's brilliant Wil - I'll do that.

Many thanks again,

Forum Jump:

Users browsing this thread: 1 Guest(s)