Results 1 to 18 of 18

Thread: Width of code 'Box'.

  1. #1

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Width of code 'Box'.

    I spent ages writing a post in HERE yesterday, I definitely clicked 'Submit New Thread' but it's not here !
    I shall try again...

    When posting or reading posts which include a 'Code Box', why is it that the 'Code Box' is always much narrower than the page it's on ? There are always very large margins either side of this 'Code Box', other text is much wider on the page than a 'Code Box'.

    I have tried to make the box wider without success, even when I've clicked the link to expand the form to full width, the 'Code Box' has not changed it's width.

    The narrow width of the box often forces lines of code to wrap to the line below, making complicated code even more difficult to read.

    Is there something I'm doing wrong, or maybe something I'm not doing, to make code boxes more readable ?

    Poppa.
    Last edited by Poppa Mintin; Jan 12th, 2016 at 07:33 PM. Reason: Typo correction
    Along with the sunshine there has to be a little rain sometime.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Width of code 'Box'.

    I second this motion. @Poppa Mintin, I don't think that it's anything that you're doing because I see the same thing and I have the same issue with it. I don't see why code boxes should not expand to the full width of the page. In this age of widescreen monitors, it seems sill to restrict the width of page elements like that, especially when, as you say, it can make code quite hard to read at times.

  3. #3
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    vBulletin is a third party software product, so we have some limits on what we can change. I know the code box is set to work on a screen that is 1280 pixels wide in general as that is a happy median. I don't believe there is a dynamic setting in vBulletin to push the code box to change with the changing of the screen width. If someone knows of such a setting (and where it is), let me know.

    Brad!

  4. #4

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: Width of code 'Box'.

    Brad,

    Is there a chance the third party would answer that question ?

    Is there a chance the third party might be prevailed upon to provide a means to adjust the width if it doesn't already exist ?

    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  5. #5
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Third party is vBulletin. It seems that we went though this discussion a while back on one of our dev forums (this one or Codeguru most likely). It isn't as simply as being dynamic because the box is within a box within a structure, etc. More to the point, the layout of the site is templatized so that you can change things around. That means dynamic widths within areas that are also dynamic start to get.....iffy.

    Having said all that, I've not looked at this in a while (beyond a look earlier today where I couldn't find all the settings.....) Something might have changed, so we can take a look as time allows.

    Edit: I did find the setting for the vertical height (set to 30 lines maximum). I didn't find the width setting. As stated earlier, if anyone knows where that is, let me know. I know we have a few vBulliten experts that roam this site!)
    Have you given out your reputation points today? Select the Rate This Post link to give points for good posts!
    -------------------------------------------------------------
    Brad! Jones
    Lots of Software, LLC
    (I wrote: C Programming in One Hour a Day) (Dad Jokes Book) (Follow me on Twitter)

    --------------------------------------------------------------

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.

    Quote Originally Posted by brad jones View Post
    Edit: I did find the setting for the vertical height (set to 30 lines maximum). I didn't find the width setting. As stated earlier, if anyone knows where that is, let me know. I know we have a few vBulliten experts that roam this site!)
    Its somewhere in the HTML where it says, p.className=='bbcode_code , and was hard coded to 650 pixels.... cause when I was using firefox I sometimes used to enable this script i made to make the code boxes as wide as possible.

  7. #7
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Quote Originally Posted by Edgemeal View Post
    Its somewhere in the HTML
    That's likely the HTML code generated by the vBulletin software. A lot of the pages are dynamically generated. There are thousands of settings, configuration files, and other markup things that are used to customize things like the code box width, where things are displayed, and what is displayed. While hacking code could be done.... it is not the approach we take. Hacks get overwritten when we do updates. As such, we have to find the right spot int he configurations and such to make sure we fix this in a way that doesn't get undone in the future.

    Thanks, however, for pointing that out as it might help me find the right spot.

  8. #8
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.

    Quote Originally Posted by brad jones View Post
    That's likely the HTML code generated by the vBulletin software. A lot of the pages are dynamically generated. There are thousands of settings, configuration files, and other markup things that are used to customize things like the code box width, where things are displayed, and what is displayed. While hacking code could be done.... it is not the approach we take. Hacks get overwritten when we do updates. As such, we have to find the right spot int he configurations and such to make sure we fix this in a way that doesn't get undone in the future.

    Thanks, however, for pointing that out as it might help me find the right spot.
    Ya I realized that after posting, but the width is hard coded to 650(or was last time i looked a year ago), and when looking at other forums I notice they use a percentage to set the code box widths.
    Thanks again!

  9. #9
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Quote Originally Posted by Edgemeal View Post
    Ya I realized that after posting, but the width is hard coded to 650(or was last time i looked a year ago), and when looking at other forums I notice they use a percentage to set the code box widths.
    Thanks again!
    Do you know if the other forums were using vBulletin? If so, then we know we can make it work

  10. #10
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.

    Quote Originally Posted by brad jones View Post
    Do you know if the other forums were using vBulletin? If so, then we know we can make it work
    Ya vBulletin, "vBulletin 4.2.2", for example,
    http://www.xtremesystems.org/forums/...ltiThread-Test

  11. #11
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Testing....

    Test 3
    Code:
    This is a bunch of code Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line  1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line  1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line 1Line  1Line 1
    Line 2 Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line  2Line 2 Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line 2Line  2Line 2Line 2Line 2 Line 2Line 2Line 2Line 2Line 2Line 2Line 2 Line  2Line 2Line 2Line 2Line 2Line 2Line 2
    Line 3 Line 3Line 3Line 3Line 3Line 3Line 3Line 3Line 3Line 3Line 3Line  3Line 3Line 3Line 3Line 3Line 3Line 3 Line 3Line 3Line 3Line 3Line 3Line  3Line 3Line 3Line 3Line 3Line 3Line 3Line 3Line 3 Line 3Line 3Line  3Line 3Line 3Line 3Line 3 Line 3Line 3Line 3Line 3Line 3Line 3
    Test 2
    Code:
    this is code
    this is code
    this is line3

  12. #12
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Here is the code for setting the width. Anyone want to suggest what should change to make it dynamic?

    Code:
    <div class="bbcode_container">
                    <div class="bbcode_description">{vb:rawphrase code}:</div>
                    <pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="width:650px;height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}
    <vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>{vb:raw code}</pre>
    </div>

  13. #13
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    (and as a note - I had Heidi adjust it to 850px from 650px. This will help for those using larger resolutions. For those with lower resolutions, it might push the right rail ads a bit off the screen.... )

  14. #14
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.

    Quote Originally Posted by brad jones View Post
    (and as a note - I had Heidi adjust it to 850px from 650px. This will help for those using larger resolutions. For those with lower resolutions, it might push the right rail ads a bit off the screen.... )
    Instead of 850px can you use a percentage like i did in my FF script?, that way the code window will auto size.

    Odd?...When I'm previewing my post in edit mode I can see and use the Horiz scrollbar for code box ( Chrome/Win7), but not when I'm just browsing!

  15. #15
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Let me talk to Heidi tomorrow about the percentage. If she has time, we can test it and see what it does.
    Have you given out your reputation points today? Select the Rate This Post link to give points for good posts!
    -------------------------------------------------------------
    Brad! Jones
    Lots of Software, LLC
    (I wrote: C Programming in One Hour a Day) (Dad Jokes Book) (Follow me on Twitter)

    --------------------------------------------------------------

  16. #16
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.

    Quote Originally Posted by brad jones View Post
    Let me talk to Heidi tomorrow about the percentage. If she has time, we can test it and see what it does.
    Well that extra 200px helps a lot, Thanks again!

    EDIT Are the vb.net Code windows still only 650?
    Looking at my old test here for example the "Code" and "vb.net Code" have different widths (CHROME/WIN7).
    Last edited by Edgemeal; Jan 14th, 2016 at 03:23 PM.

  17. #17
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: Width of code 'Box'.

    Quote Originally Posted by Edgemeal View Post
    EDIT Are the vb.net Code windows still only 650?
    Probably. I think Heidi only mentioned code and php. Likely we overlooked vb. Is vb still important?

    Brad!
    (yes, that was a joke)
    Have you given out your reputation points today? Select the Rate This Post link to give points for good posts!
    -------------------------------------------------------------
    Brad! Jones
    Lots of Software, LLC
    (I wrote: C Programming in One Hour a Day) (Dad Jokes Book) (Follow me on Twitter)

    --------------------------------------------------------------

  18. #18
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Width of code 'Box'.



    FWIW, I don't use IE11 but I tried it and it shows a horiz scrollbar when looking at my old test , and can only see about 1/2 of the right-side panel unless I scroll the browser horizontally.



    Chrome works fine though.
    Happy debugging!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width