TheWizardOz TheWizardOz

Widget to display web page

Widget to display web page

Hi,

I am a developer and have just started looking into DesktopX, and compared with many other solutions out there I have to say that I like it quite a lot. OK, to get to the point:

I need to create a widget that will display any page (configurable) in a widget. At this point I am hardcoding the web address into the script, I'm pretty sure that I can figure out how to the customization allowing the web site to be set by the user.

I have been able to accomplish this to some degree by creating an object with the following code:

Sub Object_OnScriptEnter
Control.Navigate2 "http://www.somesite.com"
End Sub

But I am having the following problems with this method:

1. One is unable to do anything with the widget, and it can only by moved with a right-click. Is that normal?
2. I would like to display some sort of frame around it. I tried to set the option looking at the picture frame widget (which seems to do that in the States->Appearance tab), but this tab is not available in my object.

The frame is really the most crucial thing for me I believe at this point, so any help with this would be appreciated.


Thanks!
9,634 views 28 replies
Reply #26 Top
OK - it works now! Hooray!

I didn't realize that I can set the object name on the last tab under "Object ID". Now I can refer to it and it's very nice.


Thanks for all your help - I'm almost done!
Reply #27 Top
Here comes another one

Do you know if there is an *easy* way to save the preferences across system reboots? Do I have to code this myself using things like Registry access etc.? I can do that, I was just hoping that I wouldn't have to ...
Reply #28 Top
Object.LocalStorage, Object.PersistStorage

When coding it is often useful to store persistent information which can be retrieved and used as required across multiple executions of the same object or widget.
To store data you need to give the data a unique reference (for that object) and set it's value. For example Object.LocalStorage("MyZip") = 48152 would place the value 48152 in a storage variable called MyZip. "MyZip"=48152 will be automatically saved and restored when the object is unloaded and reloaded.
The difference between the two types is in its persistence across object packaging and distribution. LocalStorage will NOT be saved when the object is saved as .dxpack or a widget is built. PersistStorage instead will save its value.
LocalStorage is useful to store personal information, like a passwork or a ZIP code. Infact, you don’t want such information to be preserved when you export and redistribute the object to other people. However, you want these values to be preserved across multiple run of the same object/widget.

Example:

Sub Object_OnScriptEnter
If Object.LocalStorage("MyZip") = "" Then
Object.LocalStorage("MyZip") = "48152"
End If
Object.SetTimer12346, 3600000
End Sub

Sub Object_OnTimer12346
GetWeather(Object.LocalStorage("MyZip"))
End Sub

Sub Object_OnScriptExit
Object.KillTimer 12346
End Sub

Function GetWeather(zip)
...
End Function


Posted via WinCustomize Browser/Stardock Central