Page 1 of 1

Webgadget Callback

Posted: Mon Aug 14, 2017 12:26 pm
by mk-soft
Callback not work

Code: Select all

Procedure NavigationCallback(Gadget, Url$) 
  Debug Url$
  If Url$= "http://www.purebasic.com/news.php" 
    MessageRequester("", "No news today!") 
    ProcedureReturn #False 
  Else 
    ProcedureReturn #True 
  EndIf 
EndProcedure 

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com") 
  SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
  Repeat 
  Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf

Re: (PB v5.44 / v5.45) Webgadget Callback

Posted: Mon Aug 14, 2017 12:56 pm
by Shardik
As far as I know #PB_Web_NavigationCallback has never been implemented for Linux and MacOS. Take a look into the documentation:
PB documentation wrote:SetGadgetAttribute(): Set the following attributes (Windows only):

#PB_Web_ScrollX : Set the horizontal scrolling position.
#PB_Web_ScrollY : Set the vertical scrolling position.
#PB_Web_BlockPopups : Block popup windows. #PB_EventType_PopupWindow is fired if this setting is enabled.
#PB_Web_BlockPopupMenu: Block standard the popup menu. #PB_EventType_PopupMenu is fired if this setting is enabled.
#PB_Web_NavigationCallback: Set a callback for monitoring (and disabling) navigation.
In this feature request from 2013 for implementing a navigation callback for Linux and MacOS I also demonstrated workarounds.

Re: (PB v5.44 / v5.45) Webgadget Callback

Posted: Mon Aug 14, 2017 1:10 pm
by mk-soft
Ups, sorry :(

Sometimes I forget this.