WebGadget works only with 1 site?

Mac OSX specific forum
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

WebGadget works only with 1 site?

Post by Danilo »

Example:

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    Procedure OnTimer()
        DisableGadget(1, CocoaMessage(0,GadgetID(0),"canGoBack")    ! 1) ; in Class 'WebView'
        DisableGadget(2, CocoaMessage(0,GadgetID(0),"canGoForward") ! 1)
    EndProcedure
CompilerEndIf

Procedure OnBack()
    SetGadgetState(0, #PB_Web_Back)
EndProcedure

Procedure OnForward()
    SetGadgetState(0, #PB_Web_Forward)
EndProcedure

If OpenWindow(0, 0, 0, 800, 600, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 0, 25, 800, 575, "http://www.purebasic.com")
    
    ButtonGadget(1, 0, 0, 100, 25, "Back")
    BindGadgetEvent(1, @OnBack())
    ButtonGadget(2, 100, 0, 100, 25, "Forward")
    BindGadgetEvent(2, @OnForward())
    
    CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
        ; On Mac OS X we use a timer to check for 'canGoBack' and 'canGoForward'
        AddWindowTimer(0, 0, 100)
        BindEvent(#PB_Event_Timer, @OnTimer(), 0)
    CompilerEndIf
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
I can navigate on the site "www.purebasic.com" only. External links don't work here, for example
- "Support > PureBasic Forums"
- "Support > PureBasic online documentation"
- "Screenshots" -> pictures are displayed, and all links don't work

EDIT: I just realized that this links all open in a new Tab when using Chrome.
Almost everything in WebGadget is Windows-only (Navigation Callback,
SetGadgetAttribute() & GetGadgetAttribute(), #PB_EventType_PopupWindow event),
so it looks quite useless to me, without doing everything with WebKit API directly.


Another issue:
With enabled Debugger, I get the following message most of the time:
PureBasic Debugger
The debugged executable did not respond to communication for 10 seconds. Disconnecting.
I get the message immediately after hitting F5 key. It is not waiting 10 seconds.

Anyone able to confirm this?

EDIT: After restarting the IDE, the debugger issue is gone. Works with debugger now.
Last edited by Danilo on Wed Sep 10, 2014 8:08 am, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: WebGadget works only with 1 site?

Post by wilbert »

About the links to other sites, it has to do with the WebPolicyDelegate protocol.
https://developer.apple.com/library/mac ... rence.html

See also this thread
http://www.purebasic.fr/english/viewtop ... 24&t=53823
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: WebGadget works only with 1 site?

Post by Danilo »

wilbert wrote:About the links to other sites, it has to do with the WebPolicyDelegate protocol.
https://developer.apple.com/library/mac ... rence.html

See also this thread
http://www.purebasic.fr/english/viewtop ... 24&t=53823
Thanks wilbert!
Post Reply