ScrollBars of Webgadget
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am
ScrollBars of Webgadget
Hi Guys,
is it possible to change the scrollbar position of a webgadget ?
Thanks in advance
Aero
is it possible to change the scrollbar position of a webgadget ?
Thanks in advance
Aero
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
IMHO only through the shown HTML-documents.
When I recall it right, there should be a possibility with the css-rule direction set to rtl in the body tag!? But be careful, the alignement of other elements will also change, this effect can be compensated by capsulating them within an div set to direction:ltr.
When I recall it right, there should be a possibility with the css-rule direction set to rtl in the body tag!? But be careful, the alignement of other elements will also change, this effect can be compensated by capsulating them within an div set to direction:ltr.
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
Well, the WebGadget is nothing but an embedded IE-Window. So it behaves like that and I've never heard that the user itself can choose as to where the scrollbars should go.
Try
if you are the one writing the HTML to be shown
Try
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Scrollbar to the left</TITLE>
</HEAD>
<BODY style="direction:rtl">
<div style="direction:ltr">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci
tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo
consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et
accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit
amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod
tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad
minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et
accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum
soluta nobis eleifend option congue nihil imperdiet doming id quod mazim
placerat facer possim assum.
</div>
</BODY>
</HTML>
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am
I am working on a small programm, where i would like to define the viewable area of a html page with scroll parameters like this /X=100 /Y=100. It works with a scroll area gadget, but it looks a little bit strange with two sets of scrollbars. Is it not possible to manipulate the position of the scrollbars from within purebasic with an api command like setscrollPOS_ or setScrollWindow_ ?
I'm sure there's a better way (IHTMLElement2 Interface?) to do this, but my knowledge doesn't reach that far.
Here's a JavaScript way of setting the scrollbars...

Here's a JavaScript way of setting the scrollbars...
Code: Select all
#READYSTATE_UNINITIALIZED=0
#READYSTATE_LOADING=1
#READYSTATE_LOADED=2
#READYSTATE_INTERACTIVE=3
#READYSTATE_COMPLETE=4
page_loaded = #False
If OpenWindow(0, 0, 0, 650, 500, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Set scroll bars")
If CreateGadgetList(WindowID())
WebGadget(0,10,10,630,480,"http://www.purebasic.com")
WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
WebObject\get_ReadyState(@webState)
If webState = #READYSTATE_COMPLETE And page_loaded = #False
SetGadgetText(0,"javascript:window.scrollTo(50, 150)"); sets x, y scroll position
page_loaded = #True
EndIf
Until Event = #PB_EventCloseWindow
End
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Sparkie,
Even though it exist a better answer your code samlpe is nice and simple.
Rgrds
Even though it exist a better answer your code samlpe is nice and simple.
Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
Ah, now I see what you were asking for. So I was on the wrong track all the time
kewl
I'm not sure if I can help you, but have you ever tried to get the window handle of the WebGadget and then simply call SetScrollPos() or the like?
Perhaps the Window with the Scrollbars isn't the same like the Window containing the WebGadget. In this case a) Fred could enlighten us or b) you could experiment a little with GetWindow()
Good luck

I'm not sure if I can help you, but have you ever tried to get the window handle of the WebGadget and then simply call SetScrollPos() or the like?
Perhaps the Window with the Scrollbars isn't the same like the Window containing the WebGadget. In this case a) Fred could enlighten us or b) you could experiment a little with GetWindow()
Good luck
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am
Thanks for the answers !! It works, but is really slow until something happens. Perhaps Fred does know the answer ? I thought the same about the handle and tried all variations of this code with all children under the gadget (looked into it with Winspector Spy), but it didn't worked either
Do you see some potential to optimize this code:
Code: Select all
hwin=FindWindow_(0, "Webbrowser")
hwin = GetWindow_(hwin,#GW_child)
Code: Select all
Repeat
Delay=(500)
Event = WindowEvent()
WebObject\get_Busy(@IsBusy.l)
If IsBusy
Loading.f=1
Else
Loading.f=0
Delay=(500)
UseWindow(0)
MoveWindow(WindowXPos.f,WindowYPos.f)
ResizeWindow(WindowWidth.f, WindowHeight.f)
AnimateWindow_(WindowID(0), 800, #AW_BLEND)
EndIf
WebObject\get_ReadyState(@webState)
If webState = 4 And page_loaded = #False
SetGadgetText(1,"javascript:window.scrollTo(50, 150)"); sets x, y scroll position
page_loaded = #True
EndIf
Until Loading=0 And page_loaded =#True
Last edited by Aeroschmelz on Tue May 04, 2004 3:58 pm, edited 1 time in total.
...,
SetScrollPos_() returns false from API.
This means probably that WebGadget's scrollbars are not defined at the CreateWindow(Ex)_ level.
I don't know how to get scrollbar's handles then.
Rgrds
SetScrollPos_() returns false from API.
This means probably that WebGadget's scrollbars are not defined at the CreateWindow(Ex)_ level.
I don't know how to get scrollbar's handles then.
Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am
Is there also a possibility to get this java code working in the same way ?:
Code: Select all
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function BodyZoom()
{
top.location.href = "http://www.google.de"
document.body.style.zoom = 2
}
//-->
</SCRIPT>
</head>
<BODY ID="bd" OnLoad="BodyZoom()" >
...,
I only remember the following is possible :
But I guess it does not go well using head functions ...
I only remember the following is possible :
Code: Select all
url$="javascript:document.write('<BODY BGCOLOR=#000000 TEXT=#FFFF00><H1><U>Hello World</U></H1></BODY>'); document.close()"
setgadgettext(#WebGadget, url$)
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
How about this for the zoom...Aeroschmelz wrote:Is there also a possibility to get this java code working in the same way ?:
Code: Select all
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function BodyZoom() { top.location.href = "http://www.google.de" document.body.style.zoom = 2 } //--> </SCRIPT> </head> <BODY ID="bd" OnLoad="BodyZoom()" >
Code: Select all
SetGadgetText(0,"javascript:void(document.body.style.zoom='2.0')")
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
-
- User
- Posts: 25
- Joined: Mon Apr 12, 2004 9:14 am