Hi Rashad
Well, funny thing is that the code only wants to work with "http://www.purebasic.com". I have tried several websites (mostly home pages) now and they all re-size to a small 45x45 square (including this forum)
So, I thought "maybe the Window has to be re-sized too", but nope, that makes no difference:
Code:
Enumeration
#Win
#Web
#Btn
EndEnumeration
OpenWindow(#Win, 0, 0, 1024, 840, "Resize WebGadget", #PB_Window_SystemMenu)
WebGadget(#Web, 10, 10, 300, 300, "http://www.qinbiying.co.uk")
ButtonGadget(#Btn, 10, 810, 60, 25, "Resize")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case #Btn
SetGadgetAttribute(#Web, #PB_Web_ScrollX, 2000)
SetGadgetAttribute(#Web, #PB_Web_ScrollY, 2000)
iNewW.i = GetGadgetAttribute(#Web, #PB_Web_ScrollX) + 60
iNewH.i = GetGadgetAttribute(#Web, #PB_Web_ScrollY) + 60
ResizeWindow(#Win,0,0,iNewW + 10,iNewH + 10)
ResizeGadget(#Web,10,10,iNewW,iNewH)
EndSelect
EndSelect
Until Quit = 1
Edit: I was wondering if GetGadgetAttribute with #PB_Web_ScrollX/Y was the culprit, but seems it could be SetGadgetAttribute, which I thought should set the WebGadget scroll bars to a specific position, but hard to tell if that works or not (not knowing the range):
Code:
Enumeration
#Win
#Web
#Btn
EndEnumeration
Procedure OpenWin()
;------------------
OpenWindow(#Win, 0, 0, 1024, 840, "Resize WebGadget", #PB_Window_SystemMenu)
WebGadget(#Web, 10, 10, 500, 300, "http://www.qinbiying.co.uk")
SetGadgetAttribute(#Web, #PB_Web_ScrollX, 200)
SetGadgetAttribute(#Web, #PB_Web_ScrollY, 200)
ButtonGadget(#Btn, 10, 810, 60, 25, "Resize")
EndProcedure
OpenWin()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case #Btn
SetGadgetAttribute(#Web, #PB_Web_ScrollX, 2000)
SetGadgetAttribute(#Web, #PB_Web_ScrollY, 2000)
iNewW.i = GetGadgetAttribute(#Web, #PB_Web_ScrollX) + 60
iNewH.i = GetGadgetAttribute(#Web, #PB_Web_ScrollY) + 60
ResizeWindow(#Win,0,0,iNewW + 10,iNewH + 10)
ResizeGadget(#Web,10,10,iNewW,iNewH)
EndSelect
EndSelect
Until Quit = 1
Edit Edit: Ha, my code above does not even work with "http://www.purebasic.com"
