WebGadget: How to use???

Linux specific forum
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

WebGadget: How to use???

Post by bender-rulez »

Hi,

I have read that in PB 3.93 the Webgadget should work, but how to use it, what about the link to libgtkembedmoz.so had to be done??

I really need it, cause I want to use XUL with PB!

Thanks
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Some tried and got it working, some other not, so it's not easy to use it. Be sure you have the .so file on your pc, and if yes you can do a symbolic link (ln -s) in your lib directory and run ldconfig. If all goes well, the webgadget() will be created. Be sure to pass an URL in the WebGadget() call as there was a little bug with SetGadgetText(). It does need GTK2 too, so ensure than -s gtk2 compiler switch is activated.
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

WebGadget: How to use???

Post by bender-rulez »

So, I have done it that way, it compiles without any error:

Code: Select all

If OpenWindow(0,0,0,600,300,#PB_Window_SystemMenu,"WebGadget") And CreateGadgetList(WindowID(0))
  WebGadget(0,10,10,580,280,"http://www.purebasic.com")
  ; Note: if you want to use a local file, change last parameter to "file://" + path + filename
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
but when I start the programm the window seems to be empty?

I have 'libgtkembedmoz.so' from a Mozilla installation linked to /usr/lib/libgtkembedmoz.so and I used the -s gtk2 option for the compiler!

Any hints?
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

could you check the result of the WebGadget() function ? If it's 0, then the gadget has not be created.
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Webgadget

Post by bender-rulez »

Yes, that makes sense! It is '0'!

Whats now? How to find out why it is not created?
Is there any way to debug it?
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

What distro are you running??

Anyway. Here's how i got it working on Mandrake 10.1:
I take it you have created the link in /usr/lib/ already..
(Seems like this isn't always enough...)

Do the following as root:

Add '/path-to-libgtkembedmoz.so to /etc/ld.so.conf
On mdk this is: /usr/lib/mozilla-1.7.2
Then do a ldconfig

Should say that after i did this i also found out that
you can create a file in /etc/ld.so.conf.d (if that folder exist)
named somefile.conf (just the .conf part i important)
And add the path to the lib into that file..
Then do ldconfig..
Last edited by olejr on Tue Mar 15, 2005 12:53 pm, edited 2 times in total.
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Webgadget

Post by bender-rulez »

I have done now done the entry in ld.so.conf
'/opt/mozilla/lib' running SuSE 9.1

On SuSE 9.1 there is no dir '/etc/ld.so.conf.d'
therefore I dont maked an entry in some.conf

I also need to do 'export PKG_CONFIG_PATH=/opt/gnome/lib/pkgconfig'
to find the gtk2 libs when compiling

when I start the compiled programm

Code: Select all

If OpenWindow(0,0,0,600,300,#PB_Window_SystemMenu,"WebGadget") And CreateGadgetList(WindowID(0))
  
  test = WebGadget(0,10,10,580,280,"http://www.purebasic.com")
  ; Note: if you want to use a local file, change last parameter to "file://" + path + filename

  Ergebnis$ = Str(test)

MessageRequester ("Information",Ergebnis$,0)

  
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf 
the result of the return value of WebGadget is: 134787096
????
The MessageRequester appears after taking a lot CPU time!
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Webgadget

Post by bender-rulez »

The Return value changed to: 134787024

?
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

It seems to work then..
The return value from WebGadget() is "right" as it is not '0'..

Doesn't it display anything??
The MessageRequester appears after taking a lot CPU time!
This is normal.. It's the WebGadget that try to load the page..
It doesn't eat CPU after the requester comes up does it?
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Webgadget

Post by bender-rulez »

Yes, the cpu time is idle after the messagerequester!
No, it doesn't display anything! :-(
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Hm... Try this:

Code: Select all

If OpenWindow(0,0,0,600,300,#PB_Window_SystemMenu,"WebGadget") And CreateGadgetList(WindowID(0))
 
  test = WebGadget(0,10,10,580,280,"http://www.purebasic.com")
  ; Note: if you want to use a local file, change last parameter to "file://" + path + filename

  SetGadgetText(0, "http://www.purebasic.com") ; <- Add this line to your code

  Ergebnis$ = Str(test)

  MessageRequester ("Information",Ergebnis$,0)

 
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Webgadget WORKS!!!

Post by bender-rulez »

YES!!! You are the man! It works very well!!!

:-)

Now I can make my integrated Socket SQLite XUL Rendering Programm!

;-)

one question! will it be possible to use the mozilla lib on windows too??

instead the internet explorer?

would be cool!
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

:D :D

Just remembered that the bug is that the WebGadget didn't take the url passed to it.. :wink:

There's plenty of bugfixes for PureBasic Linux at:
http://www.purebasic.com/beta/linux
Everything in the gtk2 folder goes into /path-to-pb-install/purebasic/subsystems/gtk2/purelibraries/
Just don't install the gtkbase library that is there.. I think that has some thread spesific things in it.
And the rest to: /path-to-pb-install/purebasic/purelibraries/
(The copy must be done as root..)


And no, the Mozilla is Linux only..

Oh.. and there isn't long before v3.93b i think.. :wink:

@Fred: A little update on how to make this work.. If done as I described, there's no need for the symbolic-link..
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Good idea olejr, I will include your way which seems much safer than creating a symbolic link :).
kake26
Enthusiast
Enthusiast
Posts: 157
Joined: Sun Jan 25, 2004 7:21 pm
Contact:

Post by kake26 »

WOW

PureBasic just went up like my number one choice for Linux development. I have to applaud this big time. Hats off to Fred. Happy st. patricks day, while I'm at it.
Post Reply