Wider Code Box (1 Viewer)

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:44
Joined
Jan 20, 2009
Messages
12,852
The Quote box has a dynamic width but the Code box is fixed to a relatively narrow size.

It would be nice if the Code box could be made more like the Quote box. It would be far easier to read. The code box is only half the width of my monitor.:(

I guess the difference is the code box is designed to force a horizontal scroll bar where the quote box content would wrap.
 

Rx_

Nothing In Moderation
Local time
Today, 01:44
Joined
Oct 22, 2009
Messages
2,803
Yes, I agree!
Wider is better.
I have to put on my reading glasses to read the code box.
(no smileys with reading glasses or I would use them!)
 

SOS

Registered Lunatic
Local time
Today, 00:44
Joined
Aug 27, 2008
Messages
3,517
I'll throw my agreement in there too.
 

Jon

Access World Site Owner
Staff member
Local time
Today, 08:44
Joined
Sep 28, 1999
Messages
7,388
What do you guys mean by the code box?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:44
Joined
Jan 20, 2009
Messages
12,852
Text with the Code wrapper around it.
 

SOS

Registered Lunatic
Local time
Today, 00:44
Joined
Aug 27, 2008
Messages
3,517
What do you guys mean by the code box?


This is a code box:

Code:
Dim Something As Something
Dim strWooHoo As SomethingElse
 
Etc.......
 
' and more...
 

ChrisO

Registered User.
Local time
Today, 17:44
Joined
Apr 30, 2003
Messages
3,202
G’day Jon.

When we wrap code in the code tags we get this: -


Code:
Option Explicit
Option Compare Text


' Set to False if you do NOT want to
' overload the Access MkDir statment.
#Const conOverloadMkDir = True


' KPD-Team 2000
' URL: http://www.allapi.net/
' E-Mail: KPDTeam@Allapi.net
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long


#If conOverloadMkDir Then
Public Function MkDir(ByVal vntPath As Variant, _
                   Optional intErrorMode As Integer = 0) As Variant
                   
    ' Author         : ChrisO (URL: http://www.access-programmers.co.uk/forums/)
    ' Date           : 11-Mar-2010
    ' Revisions      : 13-Mar-2010 (Push back to Access 97)
    ' Contributors   : KPD-Team 2000 (URL: http://www.allapi.net/)
    ' Error Modes    : 0 = Silent (No internal messages)
    '                :     Return Integer Success or Failure (-1=Success/True) (0=Failure/False)
    '                : 1 = Silent (No internal messages)
    '                :     Return Error Description
    '                : 2 = Display internal messages
    '                :     Return Integer Success or Failure (-1=Success/True) (0=Failure/False)
    '                : 3 = Display internal messages
    '                :     Return Error Description
    '                :
    ' User Revisions : If you modify this code please do so in a way that Access97 users can use it.
    '                : Please test it under different Regional Settings.
    '                : Please bear in mind non-English version users.

    
    Dim intSuccess     As Integer   ' A Boolean could interfere with non-English versions of Access.
    Dim lngPos         As Long      ' Position of character in Path during parse.
    Dim lngErrorNumber As Long      ' Copy of VBA.Err.Number for error handling.
    Dim strDescription As String    ' Copy of VBA.Err.Description for error handling.
    Dim strChr         As String    ' Character used in parsing.
    Dim strTemp        As String    ' Temporary string for parsing.
    
    On Error GoTo ErrorHandler
    
    ' Set the default return valve.
    intSuccess = False
    
    ' Check for Null or ZLS.
    If VBA.Len(vntPath) Then
        ' Set the initial return valve.
        intSuccess = True
        
        ' The standard MkDir works with a '/', the API does not.
        For lngPos = 1 To VBA.Len(vntPath)
            strChr = VBA.Mid$(vntPath, lngPos, 1)
            If strChr = "/" Then strChr = "\"
            strTemp = strTemp & strChr
        Next lngPos

        vntPath = strTemp
        strTemp = ""
        
        ' Remove all sequences of Space and \
        For lngPos = 1 To VBA.Len(vntPath) - 1
            strChr = VBA.Mid$(vntPath, lngPos, 2)
            If strChr = " \" Then
                strTemp = strTemp & "\"
            Else
                strTemp = strTemp & strChr
                lngPos = lngPos + 1
            End If
        Next lngPos
        
        vntPath = strTemp

        ' If the last character is a '\' or a space then remove it.
        While VBA.Right$(vntPath, 1) = "\" Or VBA.Right$(vntPath, 1) = " "
            vntPath = VBA.Left$(vntPath, VBA.Len(vntPath) - 1)
        Wend
        
        ' Add a last '\'.
         vntPath = vntPath & "\"
        
        ' Scan the Path for invalid characters.
        For lngPos = 1 To VBA.Len(vntPath)
            Select Case VBA.Mid$(vntPath, lngPos, 1)
                Case "*", "?", VBA.Chr$(34), "<", ">", "|"
                    ' Set the return value to not valid.
                    intSuccess = False
                    
                    If intErrorMode = 1 Or intErrorMode = 2 Then
                        VBA.MsgBox "Character '" & VBA.Mid$(vntPath, lngPos, 1) & "' is not allowed in Directory name." & VBA.vbNewLine & _
                        "Directory was not created.", _
                        VBA.vbCritical + VBA.vbOKOnly, _
                        "Create Directory Failure"
                    End If

                ' Check for ':' other than following the drive letter.
                Case ":"
                    If lngPos <> 2 Then
                        ' Set the return value to not valid.
                        intSuccess = False
                        
                        If intErrorMode = 1 Or intErrorMode = 2 Then
                            VBA.MsgBox "Character ':' is only allowed after Drive letter." & VBA.vbNewLine & _
                            "Directory was not created.", _
                            VBA.vbCritical + VBA.vbOKOnly, _
                            "Create Directory Failure"
                        End If
                    End If

                    ' Check if ':' is followed by '\'
                    If lngPos <> VBA.Len(vntPath) Then
                        If VBA.Mid$(vntPath, lngPos + 1, 1) <> "\" Then
                            ' Set the return value to not valid.
                            intSuccess = False
                            
                            If intErrorMode = 1 Or intErrorMode = 2 Then
                                VBA.MsgBox "Character '\' is required after Drive letter and ':'" & VBA.vbNewLine & _
                                "Directory was not created.", _
                                VBA.vbCritical + VBA.vbOKOnly, _
                                "Create Directory Failure"
                            End If
                        End If
                    End If
            End Select

            ' Exit loop on not valid.
            If Not (intSuccess) Then Exit For
        Next lngPos
    
        ' If valid so far then...
        If (intSuccess) Then
            ' Check if Drive letter specified but path length is NOT correct.
            If VBA.InStr(vntPath, ":") And VBA.Len(vntPath) < 4 Then
                ' Set the return value to not valid.
                intSuccess = False
                        
                If intErrorMode = 1 Or intErrorMode = 2 Then
                    VBA.MsgBox "Incorrect Directory length after Drive letter." & VBA.vbNewLine & _
                    "Directory was not created.", _
                    VBA.vbCritical + VBA.vbOKOnly, _
                    "Create Directory Failure"
                End If
            Else
                ' Try creating the directory and return the result.
                ' If Drive letter is not specified,
                ' create the directory relative to current directory.
                ' A return value of 0 from the API is a failure.
                intSuccess = Not (MakeSureDirectoryPathExists(vntPath) = 0)
            End If
        End If
    End If
    
    ' Return the result depending on passed Error Mode.
    Select Case intErrorMode
        Case 0, 2
            MkDir = intSuccess
        
        Case 1, 3
            ' If error description = ZLS return description 'None'
            MkDir = VBA.IIf(VBA.Err.Description = "", "None", VBA.Err.Description)
   
        Case Else
            ' Out of range argument passed.
            ' They get what they deserve.
            MkDir = False
    
    End Select
    
ExitProcedure:
    Exit Function
    
ErrorHandler:
    ' Make copy of the VBA.Err Data.
    lngErrorNumber = VBA.Err.Number
    strDescription = VBA.Err.Description
    
    ' No more errors please.
    On Error Resume Next

    ' Should the error be displayed?
    If intErrorMode = 2 Or intErrorMode = 3 Then
        VBA.MsgBox "Error in MkDir() in Module mdlOverloadMkDir" & VBA.vbNewLine & _
                   "Error Number     : " & lngErrorNumber & VBA.vbNewLine & _
                   "Error Description: " & strDescription, _
                   VBA.vbCritical + VBA.vbOKOnly, _
                   "Error in MkDir Overload"
    
    End If
    
    ' What do we want to return?
    If intErrorMode = 1 Or intErrorMode = 3 Then
        MkDir = strDescription
    Else
        MkDir = False
    End If
    
    ' Clear any error but do NOT Resume.
    VBA.Err.Clear
    GoTo ExitProcedure

End Function
#End If
 

ChrisO

Registered User.
Local time
Today, 17:44
Joined
Apr 30, 2003
Messages
3,202
It seems the code box is set to around 800 pixels wide. That was probably okay a few years ago but I think most people would be running screen resolutions higher than that.

Don’t know. :confused:
 

SOS

Registered Lunatic
Local time
Today, 00:44
Joined
Aug 27, 2008
Messages
3,517
It seems the code box is set to around 800 pixels wide. That was probably okay a few years ago but I think most people would be running screen resolutions higher than that.

I would think that would be a good guess.
 

ChrisO

Registered User.
Local time
Today, 17:44
Joined
Apr 30, 2003
Messages
3,202
It looks to be smaller than 800 pixels.

Took my monitor back to 800x600 and got the attached screen shot.
 

Attachments

  • 800x600.zip
    56.9 KB · Views: 174

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:44
Joined
Jan 20, 2009
Messages
12,852
I measured the code box on my system at 650 px wide.
The active area of the answer box is 612 and could be made wider too.
 

Vassago

Former Staff Turned AWF Retiree
Local time
Today, 03:44
Joined
Dec 26, 2002
Messages
4,751
I agree, they can definitely be made wider.
 

Rx_

Nothing In Moderation
Local time
Today, 01:44
Joined
Oct 22, 2009
Messages
2,803
But, not too wide! I could never bear to give up my trusty old 132 character 8 pin dot-matrix with dual directional print head and tractor green fan feed paper for printing the code window.
I have had it since the '70s and take it with me ... everywhere .. every job assignment... light rail commute... movies... vacation...church...

So, if we just have to keep the code windows small, I for one can understand how tradition might outweigh current technology.

After a very short reflection, I will throw old "dottie" under the bus if the code window gets wider.
:D
 

namliam

The Mailman - AWF VIP
Local time
Today, 09:44
Joined
Aug 11, 2003
Messages
11,695
Meh, if code goes beyond the coding box... Its rare and if it does, its crap ... ;)

For sure code should NEVER wrap like a quote box, because that would make it unreadable.
 

Jon

Access World Site Owner
Staff member
Local time
Today, 08:44
Joined
Sep 28, 1999
Messages
7,388
Any suggestions on how many pixels wide it should be?
 

ghudson

Registered User.
Local time
Today, 03:44
Joined
Jun 8, 2002
Messages
6,195
Any suggestions on how many pixels wide it should be?

As wide as a quote box and my example is your question is listed above my response in a quote box.
 

Jon

Access World Site Owner
Staff member
Local time
Today, 08:44
Joined
Sep 28, 1999
Messages
7,388
I've upped it to 800 pixels. It didn't look right when I set it to auto, which makes it the widest possible. There needs to be some distinction between the code box and the quote in my view.
 

Vassago

Former Staff Turned AWF Retiree
Local time
Today, 03:44
Joined
Dec 26, 2002
Messages
4,751
I've upped it to 800 pixels. It didn't look right when I set it to auto, which makes it the widest possible. There needs to be some distinction between the code box and the quote in my view.

It looks a lot better. Excellent job Jon! :)
 

Jon

Access World Site Owner
Staff member
Local time
Today, 08:44
Joined
Sep 28, 1999
Messages
7,388
My pleasure.
 

Users who are viewing this thread

Top Bottom