Page 1 of 1
Best way to modify the contents of a WebGadget?
Posted: Mon Dec 29, 2003 7:00 pm
by techjunkie
Hi!
Does anyone know of a simple way to modify and search the contents of a WebGadget, i.e. the actual webpage (with forms and everything).
I'm lazy and it would be nice to "not have to invent the wheel again"
(I'm familiar with Windows API and Visual C++ if that helps)
Thanks!!
Posted: Mon Dec 29, 2003 7:11 pm
by merendo
Well, as far as i understand you want to change the webpage currently displayed by the gadget.... If it's that what you want, you just need to execute one single command...
This is all documented in the manual of PureBasic.
Hope this helps :roll:
Posted: Mon Dec 29, 2003 7:21 pm
by techjunkie
merendo wrote:
Hope this helps :roll:
Well, thanks... but don't I set a complete new URL with that?
I would like to modify the existing buffer... For example, add a couple of characters in a webform that the WebGadget allready display.
Posted: Mon Dec 29, 2003 9:42 pm
by merendo
You mean, edit the content of the Webgadget as if it was a user input? Afaik it's not possible...
But you could try to set another URL wich contains the content form data. Like this: 'name=merendo&status=insane' and so on.
This could be done like this:
Code: Select all
old$=GetGadgetText(#webgadget)
parameters$="?name=merendo&status=insane"
setgadgettext(#webgadget,old$+parameters$)
I am not quite sure if this works, it's just an idea. I hope you know about html-forms and about form actions (Get and Post).
Bye! merendo
Posted: Mon Dec 29, 2003 10:19 pm
by Karbon
I think this was discussed before and, if I remember right, you have to write out a temp file and point the webgadget to it..
Posted: Tue Dec 30, 2003 5:21 am
by techjunkie
Karbon wrote:I think this was discussed before and, if I remember right, you have to write out a temp file and point the webgadget to it..
Well, I looked around the forum and decided to use the IWebBrowser2 "control"... and it seems to work well...
A small example...
Code: Select all
Enumeration 1
#OLECMDID_OPEN
#OLECMDID_NEW
#OLECMDID_SAVE
#OLECMDID_SAVEAS
#OLECMDID_SAVECOPYAS
#OLECMDID_PRINT
#OLECMDID_PRINTPREVIEW
#OLECMDID_PAGESETUP
#OLECMDID_SPELL
#OLECMDID_PROPERTIES
#OLECMDID_CUT
#OLECMDID_COPY
#OLECMDID_PASTE
#OLECMDID_PASTESPECIAL
#OLECMDID_UNDO
#OLECMDID_REDO
#OLECMDID_SELECTALL
#OLECMDID_CLEARSELECTION
#OLECMDID_ZOOM
#OLECMDID_GETZOOMRANGE
#OLECMDID_UPDATECOMMANDS
#OLECMDID_REFRESH
#OLECMDID_STOP
#OLECMDID_HIDETOOLBARS
#OLECMDID_SETPROGRESSMAX
#OLECMDID_SETPROGRESSPOS
#OLECMDID_SETPROGRESSTEXT
#OLECMDID_SETTITLE
#OLECMDID_SETDOWNLOADSTATE
#OLECMDID_STOPDOWNLOAD
EndEnumeration
Enumeration 0
#OLECMDEXECOPT_DODEFAULT
#OLECMDEXECOPT_PROMPTUSER
#OLECMDEXECOPT_DONTPROMPTUSER
#OLECMDEXECOPT_SHOWHELP
EndEnumeration
If OpenWindow(0, 0, 0, 639, 555, #PB_Window_Screencentered|#PB_Window_SystemMenu, "WebGadget Test")
If CreateGadgetList(WindowID())
WebGadget(0, 20, 85, 600, 450, "http://www.purebasic.com")
WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)
TextGadget(1, 25, 20, 75, 15, "Clipboard Text:")
StringGadget(2, 110, 15, 290, 20, "PureBasic")
ButtonGadget(3, 420, 15, 75, 20, "Set Clipboard")
ButtonGadget(4, 505, 15, 105, 20, "Paste WebGadget")
StringGadget(5, 110, 50, 290, 20, "http://www.microsoft.com")
TextGadget(6, 70, 50, 30, 15, "URL:")
ButtonGadget(7, 420, 50, 75, 20, "Go URL")
Repeat
Event = WindowEvent()
If Event = #PB_EventGadget
GadgetID = EventGadgetID()
If GadgetID = 3
SetClipboardText(GetGadgetText(2))
ElseIf GadgetID = 4
WebObject\ExecWB(#OLECMDID_PASTE, #OLECMDEXECOPT_DONTPROMPTUSER, 0, 0)
ElseIf GadgetID = 7
SetGadgetText(0, GetGadgetText(5))
EndIf
EndIf
Until Event = #PB_EventCloseWindow
EndIf
EndIf