WebGadget Example

Just starting out? Need help? Post your questions and find answers here.
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

WebGadget Example

Post by normeus »

It was on the news today Feb/15/2023 that MS Explorer was removed from windows. I tried to run the WegGadget #2 example from the Help manual, but it's missing some return / line feeds so it does not run when copied to the editor:

Code: Select all

  ; This example does display the PureBasic.com website. Inside the callback procedure
  ; the navigation to the 'News' site will be avoided (#False returned), but allowed
  ; for all other sites (#True returned).    
  Procedure NavigationCallback(Gadget, Url$) ;Windows only
    If Url$= "https://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, "https://www.purebasic.com") 
    SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
    Repeat     Until WaitWindowEvent() = #PB_Event_CloseWindow   EndIf
No problem, just press enter in a few key spots and it works, but it still shows Internet Explorer 11.
Fun fact, the menu with "News" for the PB homepage does not show on my computer windows 10 x64 pb 6.0 .
I guess because of Internet Explorer 11.
I changed the example to point to PB Support page and the callback to not allow Home page:

Code: Select all

  ; This example does display the Support page of the PureBasic.com website. Inside the callback procedure
  ; the navigation to the 'Home' site will be avoided (#False returned), but allowed
  ; for all other sites (#True returned).    
  Procedure NavigationCallback(Gadget, Url$) ;Windows only
    If Url$= "https://www.purebasic.com/index.php" 
      MessageRequester("", "Can not go home today!")       
      ProcedureReturn #False 
    Else       
      ProcedureReturn #True     
    EndIf   
  EndProcedure   
  If OpenWindow(0, 0, 0, 1310, 600, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
    WebGadget(0, 10, 10, 1290, 580, "https://www.purebasic.com/support.php") 
    SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
    Repeat     
    Until WaitWindowEvent() = #PB_Event_CloseWindow   
  EndIf
I guess my question was, is Internet Explorer gone from your computer? / Can we please, fix the example in the help file.

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari