Page 1 of 2
WebGadget: How to use???
Posted: Mon Mar 14, 2005 11:32 am
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
Posted: Mon Mar 14, 2005 2:41 pm
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.
WebGadget: How to use???
Posted: Mon Mar 14, 2005 5:02 pm
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?
Posted: Mon Mar 14, 2005 5:55 pm
by Fred
could you check the result of the WebGadget() function ? If it's 0, then the gadget has not be created.
Webgadget
Posted: Mon Mar 14, 2005 6:11 pm
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?
Posted: Mon Mar 14, 2005 6:47 pm
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..
Webgadget
Posted: Tue Mar 15, 2005 11:52 am
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!
Webgadget
Posted: Tue Mar 15, 2005 12:07 pm
by bender-rulez
The Return value changed to: 134787024
?
Posted: Tue Mar 15, 2005 12:10 pm
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?
Webgadget
Posted: Tue Mar 15, 2005 12:13 pm
by bender-rulez
Yes, the cpu time is idle after the messagerequester!
No, it doesn't display anything!

Posted: Tue Mar 15, 2005 12:18 pm
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
Webgadget WORKS!!!
Posted: Tue Mar 15, 2005 12:22 pm
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!
Posted: Tue Mar 15, 2005 12:32 pm
by olejr
Just remembered that the bug is that the WebGadget didn't take the url passed to it..
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..
@Fred: A little update on how to make this work.. If done as I described, there's no need for the symbolic-link..
Posted: Tue Mar 15, 2005 1:21 pm
by Fred
Good idea olejr, I will include your way which seems much safer than creating a symbolic link

.
Posted: Thu Mar 17, 2005 5:37 pm
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.