Best way to modify the contents of a WebGadget?

Just starting out? Need help? Post your questions and find answers here.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Best way to modify the contents of a WebGadget?

Post 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" :lol:

(I'm familiar with Windows API and Visual C++ if that helps)

Thanks!!
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post 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...

Code: Select all

SetGadgetText(#webgadget,newurl$)
This is all documented in the manual of PureBasic.

Hope this helps :roll:
The truth is never confined to a single number - especially scientific truth!
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

merendo wrote:

Code: Select all

SetGadgetText(#webgadget,newurl$)
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.
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post 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
The truth is never confined to a single number - especially scientific truth!
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post 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... :D

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
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Post Reply