Re: <FAQENTRY>4.9 code change</FAQENTRY>



On Feb 10, 4:42 am, VK <schools_r...@xxxxxxxxx> wrote:
As per recent discussion at mozilla.dev.tech.javascript
"Scrollbars not being taken into account with JavaScript"http://groups.google.com/group/mozilla.dev.tech.javascript/browse_frm...

I do agree with the OP that while saying "canvas" it is not assumed
"available space plus scrollbars" but "available space for placing
elements so minus any scrollbars"

The innerWidth/Height properties include scrollbars. AFAIK, that has
always been the case.


This way I consider the code at
"4.9 How do I find the size of the window/browser canvas area?"http://www.jibbering.com/faq/index.html#FAQ4_9
if not defective then at least misleading in many circumstances (with
innerWidth block executed) where the results are not what promised by
the FAQ title.

We went over that a few months back. The FAQ entry should be updated
to note that the dimensions may include scrollbars.


Before proposing code fixes I wondering if there is common agreement
on the issue to exist.

There are at least two solutions out there that address this issue.
Richard Cornford's "Russian Doll" version, which also calculates the
scroll position, is very efficient and well documented, but too long
for a FAQ entry. A less efficient (and largely undocumented) solution
can be found in this project:

http://code.google.com/p/niceshowcase/

This one also accounts for borders and margins on the outermost
element (body or documentElement), which affect the calculations in
some browsers. I have recently rewritten some of the code to make it
easier to follow and will add the updated version to the CWR project
when I get a chance.
.



Relevant Pages

  • 4.9 code change
    ... "Scrollbars not being taken into account with JavaScript" ... I do agree with the OP that while saying "canvas" it is not assumed ... "available space plus scrollbars" but "available space for placing ... Before proposing code fixes I wondering if there is common agreement ...
    (comp.lang.javascript)
  • Re: Getting AdjustWindowRect() to work correctly ???
    ... scrollbars are explicitly specified. ... "The AdjustWindowRect function does not take the WS_VSCROLL or WS_HSCROLL ... To account for the scroll bars, ... GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL" ...
    (microsoft.public.vc.mfc)
  • How to get _true_ client area of datagrid
    ... I need to get the actual client area of the datagrid. ... DataGrid.ClientSize doesn't seem to take into account: borders and scrollbars ...
    (microsoft.public.dotnet.languages.csharp)
  • [Tk] hard resizing
    ... And scrollbars: .ar.sx, .ar.sy ... a window .ar.c.f is created on canvas. ... The .ar frame seems to start with predefined height. ...
    (comp.lang.tcl)
  • scrollbars again
    ... However this canvas has fixed width, which makes me state from the beginning, ... window (scrollbars can remain). ... For each line there is a horizontal bar with some buttons and labels. ...
    (comp.lang.tcl)