HTMLView - how to get source

BlitzMax Forums/BlitzMax GUI Programming/HTMLView - how to get source

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

fortunately it is possible

unfortunately it is a bit ugly involving polling the eventqueue for the result

' htmlview get page source example  
' script sets the window.location which triggers an EVENT_GADGETACTION

' TODO process locations beginning with bod
' TODO provide hooked waitforscript wrapper for ease of use

Strict 

Import maxgui.win32maxguiex

Local window:TGadget
Local htmlview:TGadget

window=CreateWindow("My Window",30,20,600,440,,15|WINDOW_ACCEPTFILES)

htmlview=CreateHTMLView(0,0,ClientWidth(window),ClientHeight(window),window,HTMLVIEW_NONAVIGATE)
SetGadgetLayout htmlview,1,1,1,1 

HtmlViewGo htmlview,"www.google.com"

While WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETACTION
			Notify EventText$()
		Case EVENT_GADGETDONE
			HtmlViewRun(htmlview,"window.location=~q/body=~q+document.body.outerHTML")
	End Select
Wend