FusionBB
FusionBB Review (large)
Recent Members
Welcome them to our community!
FusionBB SWAG!

FusionBB golf shirts, t-shirts, mousepads and more.

Tagging
FusionBBDev Recent Topics
Username Post: Resize the width of Code tags        (Topic#11098)
Dennis
FusionBB Convert
Total Posts: 56
*
Location: Östersund, Sweden
Average Post Ranks%:                       
03-14-09 07:21 AM - Post#80724    



Hi all,

Below is a code sample where I use the code tag. Is it possible to resize the width of code tag?

Code:

   'Constant Variables for the database connection.     Const Con As String = "Data Source=XL-DENNIS;" _                                           & "Initial Catalog=Northwind;" _                                           & "Integrated Security=SSPI;" _                                           & "Persist Security Info=False"       'A simple SQL expression.     Const SQLExpression As String "SELECT CustomerID AS Id, CompanyName AS Company," _                                                                   "City, Region, Country FROM Customers ORDER BY CompanyName;"         Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click           'Variables for database connection and data retrievement.         Dim cn As New SqlConnection(Con)         Dim cmd As New SqlCommand(SQLExpression, cn)         cmd.CommandType = CommandType.Text         cn.Open()         'The SQL Data Reader.         Dim dr As SqlDataReader cmd.ExecuteReader(CommandBehavior.CloseConnection)         'In order to dimension the array for field names the number of columns need to be retrieved.         Dim ColsCount As Int32 = dr.FieldCount - 1         Dim FieldsArr(0, ColsCount) As String         Dim RowCounter As Int32 = 0         'The DataReader is a forward-only and read-only recordsetTherefore we cannot         'know in advance the number of records it will return. The only possible solution         'is to estimate the max number of records and use it in the solution.         Dim MaxRecords As Int32 10000         Dim DataArr(MaxRecordsColsCount) As Object           'Populate the array of field names by using the DataReader's method 'GetName'.         For NameCounter As Int32 0 To ColsCount             FieldsArr(0NameCounter) = dr.GetName(NameCounter)         Next           'Populate the array of records by reading all the records in the DataReader.         While dr.Read             For RecordCounter As Int32 = 0 To ColsCount                 DataArr(RowCounter, RecordCounter) = dr.Item(RecordCounter)             Next             RowCounter = RowCounter + 1         End While           'Close both the connection and the DataReader.         cn.Close()         dr.Close()           'Variables for Excel.         Dim xlApp As New Excel.Application         Dim xlWBook As Excel.Workbook = xlApp.Workbooks.Add( _                                                                         Excel.XlWBATemplate.xlWBATWorksheet)         Dim xlWSheet As Excel.Worksheet = CType(xlWBook.Worksheets(1), Excel.Worksheet)         Dim xlCalc As Excel.XlCalculation           'Save the present setting for Excel's calculation mode and turn it off.         With xlApp             xlCalc = .Calculation             .Calculation = Excel.XlCalculation.xlCalculationManual         End With           'Write the field names and the data to the targeting worksheet.         With xlWSheet             .Range(.Cells(11), .Cells(1ColsCount 1)).Value FieldsArr             .Range(.Cells(21), .Cells(RowCounter 2ColsCount 1)).Value DataArr             .UsedRange.Columns.AutoFit()         End With           'Make Excel available to the user.         With xlApp             .Visible = True             .UserControl = True             'Restore the calculation mode.             .Calculation xlCalc         End With           Relase objects from memory.         cmd.Dispose()         cn.Dispose()         dr Nothing         cmd Nothing         cn Nothing         xlWSheet Nothing         xlWBook Nothing         xlApp Nothing         GC.Collect()     End Sub  





Thanks in advance.
Kind regards,
Dennis

2nd edition PED


 
Chris Peterson
FusionBB Fanatic
Total Posts: 3758
*
Location: West Fargo, ND
Average Post Ranks%:                       
03-15-09 11:11 PM - Post#80759    


    In response to Dennis

That's in the stylesheet for the skin you are using. Edit the stylesheet the class is pre, edit the width. It will affect more than code tag though, quotes will also. Not sure offhand what else will be changed by that.


 
Dennis
FusionBB Convert
Total Posts: 56
*
Location: Östersund, Sweden
Average Post Ranks%:                       
03-16-09 02:53 PM - Post#80785    


    In response to Chris Peterson

Chris,

Thanks for the input. I took a look on the CSS for the skin and I realized that I don't want to take that route at this stage. I have more to learn before I challenge CSS.

Kind regards,
Dennis

2nd edition PED


 
Chris Peterson
FusionBB Fanatic
Total Posts: 3758
*
Location: West Fargo, ND
Average Post Ranks%:                       
03-16-09 05:22 PM - Post#80788    


    In response to Dennis

Just search for .pre and change the width. That's all there is too it. Just make sure you change it in the skin you are using, i.e. Professional, which is default.


 
Dennis
FusionBB Convert
Total Posts: 56
*
Location: Östersund, Sweden
Average Post Ranks%:                       
03-17-09 07:22 AM - Post#80798    


    In response to Chris Peterson

OK, You have convinced me to give it a try.

I will blame You if anything goes wrong
Kind regards,
Dennis

2nd edition PED


 
sb1963
FusionBB Fanatic
Total Posts: 1636
*
Location: UK
Average Post Ranks%:                       
 
03-17-09 08:15 PM - Post#80816    


    In response to Dennis

strange - I made a rare use of the code box on my site & the box was forced to the to probably about 2000 pixels wide as my code snippet didn't wrap


 
Dennis
FusionBB Convert
Total Posts: 56
*
Location: Östersund, Sweden
Average Post Ranks%:                       
03-17-09 08:31 PM - Post#80817    


    In response to sb1963

Chris - It works well so once again thank you.

I experience the same thing in that the code does not wrap at all.
Kind regards,
Dennis

2nd edition PED


 
Claude
FusionBB Fanatic
Total Posts: 1413
*
Location: San Diego
Average Post Ranks%:                       
03-18-09 02:04 AM - Post#80818    


    In response to Dennis

  • Dennis Said:
Chris - It works well so once again thank you.

I experience the same thing in that the code does not wrap at all.



Yeah, the problem isn't the width of the box, it's the code not wrapping. Why can't it wrap like the quote box. Is it because the text is "pre" in the CSS?


 
Chris Peterson
FusionBB Fanatic
Total Posts: 3758
*
Location: West Fargo, ND
Average Post Ranks%:                       
03-18-09 08:50 AM - Post#80820    


    In response to Claude

It's a code tag, you don't want it to wrap because you want it to be shown exactly as typed. Without being affected by markup etc.


 
Claude
FusionBB Fanatic
Total Posts: 1413
*
Location: San Diego
Average Post Ranks%:                       
03-18-09 11:05 AM - Post#80824    


    In response to Chris Peterson

  • Chris Peterson Said:
It's a code tag, you don't want it to wrap because you want it to be shown exactly as typed. Without being affected by markup etc.



Understood.


 
Couchtomatoe
Code Monkey
Total Posts: 3049
*
Birthday: 02-03 
Location: Richmond, Virginia
Average Post Ranks%:                       
 
03-18-09 11:17 AM - Post#80825    


    In response to Claude

imagine if I said change x to y and it was wrapped? you would never find it!
The artist formerly known as scroungr
Couch-Tomatoe


 
Icon Legend Permissions & Sharing Options Topic Options
Print Topic


806 Views
Calendar
SMTWTFS
 1234
567891011
12131415161718
19202122232425
262728293031 
Current Quote
"This board is already light years ahead of the old one. I'm very happy with it."
FusionBB™ Version 3.2 | ©2003-2013 InteractivePHP, Inc.
Execution time: 0.098 seconds.   Total Queries: 213   Zlib Compression is on.
All times are (GMT-4). Current time is 07:35 PM
Top