...,
Not really a valuable trick'n tips post, so I prefer to put it there for further comments !
Code: Select all
#Window_Main = 0
#Gadget_Web = 0
Dim URL.s(10)
QC.s = Chr(34)
URL(1) = "http://www.purebasic.com"
URL(2) = "javascript:void(document.body.style.zoom='3.0')"
URL(3) = "javascript:window.scrollTo(50, 150)"
URL(4) = "javascript:document.write('<BODY BGCOLOR=" + QC + "#000000" + QC + " TEXT=" + QC + "#FFFF00" + QC + "><H1><U>Hello World<BR>Width is <SCRIPT language=" + QC + "javascript" + QC + ">document.write(screen.availWidth)</SCRIPT><BR>Height is <SCRIPT language=" + QC + "javascript" + QC + ">document.write(screen.availheight)</SCRIPT></U></H1></BODY>')"
URL(5) = "about:blank"
URL(6) = "javascript:document.write('<BODY>Up to you to play more with this ...</BODY>')"
URLIndex = 0
URLMax = 6
Quit = #FALSE
WindowXSize = 640
WindowYSize = 480
If OpenWindow(#Window_Main, 0, 0, WindowXSize, WindowYSize, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "WebGadget")
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F2, #PB_Shortcut_F2)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F5, #PB_Shortcut_F5)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Back, #PB_Shortcut_Back)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Left, #PB_Shortcut_Left)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Right, #PB_Shortcut_Right)
If CreateGadgetList(WindowID(0))
WebGadget(#Gadget_Web, 10, 10, WindowXSize - 20, WindowYSize - 20, "about:blank")
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = #TRUE
Case #PB_Event_Menu
Select EventMenuID()
Case #PB_Shortcut_F2
URLIndex + 1
If URLIndex > URLMax
URLIndex = 1
EndIf
SetGadgetText(#Gadget_Web, URL(URLIndex))
SetWindowText_(WindowID(), URL(URLIndex))
Case #PB_Shortcut_F5
SetGadgetState(#Gadget_Web, #PB_Web_Refresh)
Case #PB_Shortcut_Back
SetGadgetState(#Gadget_Web, #PB_Web_Back)
Case #PB_Shortcut_Left
SetGadgetState(#Gadget_Web, #PB_Web_Back)
Case #PB_Shortcut_Right
SetGadgetState(#Gadget_Web, #PB_Web_Forward)
Case #PB_Shortcut_Escape
Quit = #TRUE
EndSelect
Case #PB_Event_Gadget
EndSelect
Until Quit
EndIf
End
Play with F2 on the keyboard and you will have some interestng effects using the WebGadget tool ... but ... it crashes sometimes and if you add more links in the list, it also may render bad results.
It seems, but I am not sure of the reason why, that the IWebBrowser2 stuff is unstable from Purebasic, or maybe my computer has some lacks.
Up to readers to answer / comment this before an eventual bug report or just any better commented information.
Rgrds