[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WebView object - Event on Link click


Sorry i did not think at the time but using MouseUp is not so good, because
it will trigger when clicked anywhere on the page, there is no way to tell
if you are still hovered over the link or not.

So I guess Benoits advice would be the best. using the Start() event to
intercept the page load.


I guess my addition to the wiki is not correct then

So i know what to add can you please explain...
When exactly does Url fire?
When exactly does Start Fire?

Thanks
BruceS


On Wed, 9 Sept 2026 at 17:07, Olivier Cruilles <olivier.cruilles@xxxxxxxx>
wrote:

> Hello,
>
> Thank you for your answer, it helped me.
>
> So WebView1_Url() does not fire and never raise on my case (Gambas Dev
> last commit), but WebView1_MouseUp() dose the job:
>
> Public Sub WebViewDoc_MouseUp()
>
>   Dim Champs1 As String[]
>
>   Print "WebViewDoc.Url = " & WebViewDoc.Link
>
>   If WebViewDoc.Link Like "doc:*" Then
>     Champs1 = Scan(WebViewDoc.Link, "*:*")
>     If Champs1.Count = 2 Then
>       Afficher_Message("Affichage du document: " & Champs1[1] & " ...",
> True)
>       Lecture_Fichier_Doc(Champs1[1])
>     End If
>   Endif
>
> End
>
> Olivier
> Le 09/09/2026 à 07:07, Bruce Steers a écrit :
>
>
>
> On Wed, 9 Sept 2026 at 11:47, gbWilly <gbWilly@xxxxxxxxxxxxxx> wrote:
>
>> On Wednesday, September 9th, 2026 at 05:38, Olivier Cruilles <
>> olivier.cruilles@xxxxxxxx> wrote:
>>
>> > Hello,
>> >
>> > I'm using a WebView (gb.qt) in one of my project and I would like to
>> > know if it's possible to raise an event when the user click on a Web
>> > Link in the web page displayed into this WebView.
>> >
>> > I tried the WebView1_Link() event but it raise when the user fly over a
>> > link with the mouse, but no way to get the link reference.
>> >
>>
>> The WebView1_Url() event is what triggers when clicking on a link.
>>
>>
>> gbWilly
>>
>> Wanna learn Gambas? - Guides overview
>>
>> GambOS
>> Gambas3 for Debian/Ubuntu
>
>
> Even better.
> I've added that little known info to the gambas wiki.
>
> BruceS
>
>

Follow-Ups:
Re: WebView object - Event on Link clickBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
WebView object - Event on Link clickOlivier Cruilles <olivier.cruilles@xxxxxxxx>
Re: WebView object - Event on Link clickgbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: WebView object - Event on Link clickBruce Steers <bsteers4@xxxxxxxxx>
Re: WebView object - Event on Link clickOlivier Cruilles <olivier.cruilles@xxxxxxxx>