What URL is in webgadget

Mac OSX specific forum
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

What URL is in webgadget

Post by jesperbrannmark »

Sorry for doubleposting.
But there must be a intelligent workaround for this issue
http://www.purebasic.fr/english/viewtop ... 24&t=52168

To just get the URL of a current webgadget? Maybe CocoaMessage?
User avatar
Kiffi
Addict
Addict
Posts: 1520
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: What URL is in webgadget

Post by Kiffi »

with #PB_Web_NavigationCallback?

Code: Select all

Procedure NavigationCallback(Gadget, Url$) 
  Debug Url$
  ProcedureReturn #True 
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
(don't know if it works under MacOS)

Greetings ... Kiffi
Hygge
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: What URL is in webgadget

Post by jesperbrannmark »

Thanks. But no :-(
The navigationcallback is windows only...
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: What URL is in webgadget

Post by wilbert »

Code: Select all

URL.s = PeekS(CocoaMessage(0, CocoaMessage(0, GadgetID(0), "mainFrameURL"), "UTF8String"), -1, #PB_UTF8)
User avatar
Shardik
Addict
Addict
Posts: 2076
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: What URL is in webgadget

Post by Shardik »

Since the navigation callback is only implemented in Windows, I have modified a nice code example from Wilbert to do the same as the example from PB help posted by Kiffi. It intercepts and denies a click onto the news hyperlink on the purebasic homepage:
http://www.purebasic.fr/english/viewtop ... 08&start=5
Post Reply