Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

Autoresize columns in table to fit Table Width

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-30-2009, 10:58 AM
ghale's Avatar
Basic4ppc Veteran
 
Join Date: Dec 2008
Location: Earth, Europe, Italy, Puglia, Lecce
Posts: 219
Default Autoresize columns in table to fit Table Width

Hello everyone,
you'll find here two short examples on how you can resize columns in a table to fit completely the table width.
The code determine automagically (thanks to Erel, agraham) the if scrollbars are visible and "fix" the widht of columns.

To simply the example,
I'll set the second column dimension to a fixed one.
With simply editing, you can add more columns and do more.

In the first example you'll find a form with a table that has a button under it.
When you press the button, the first column will resize to fit table.

In the second example there is a Timer control that resize automatically the first column to fit table just after the Form is shown on the screen.

Bye,
ghale.
Attached Files
File Type: zip Example_01.zip (23.4 KB, 166 views)
File Type: zip Example_02.zip (23.2 KB, 112 views)
Reply With Quote
  #2 (permalink)  
Old 07-31-2009, 06:02 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Thanks for sharing
__________________
Basic4android documentation
Reply With Quote
  #3 (permalink)  
Old 05-14-2010, 06:30 PM
Knows the basics
 
Join Date: May 2010
Posts: 92
Default Door library

Hello.
I don't wanna appear a smarty pants and pardon me being noobish, but it seems to me this can easily be done without any library.

Regarding the Door library...could you please give me a reference to get some
knowledge of .Net Framework and the Door library?

Kind regards.
Attached Files
File Type: sbp colFit.sbp (1.1 KB, 40 views)
Reply With Quote
  #4 (permalink)  
Old 05-15-2010, 11:05 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

He is using the Door library to pick up the width of the vertical scrollbar to correct the widths so that the horizontal scrollbar is not displayed. Your code does not do this correction and leaves part of the last column obscured by the vertical scrollbar and the horizontal scrollbar still visible.

The ultimate .NET reference is .NET Development. It is probably best to use ".NET Framework 2.0" as your reference. Methods and properties available in the Compact Framework have a little device icon by them as shown here TextBox Members (System.Windows.Forms)

Most of the UI stuff is in System.Windows.Forms, you get to that example by selecting the following in turn in the left hand pane.

.NET Development
.NET Framework 2.0
Class Library Reference
System.Windows.Forms
TextBox Class
TextBox members
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 05-15-2010 at 11:08 AM.
Reply With Quote
  #5 (permalink)  
Old 05-15-2010, 01:14 PM
Knows the basics
 
Join Date: May 2010
Posts: 92
Talking

Hellow Andrew.

Writing my code I was just lazy to subtract 10 from each final column width value so that the vertical scrolbar is not displayed.

Begarding the second column being obscured by the vertical scrollbar....it's partially obscured in Ghales table whereas in mine both columns' widths are visually equal(when the Hscrollbar is not displayed)
After all who am I to argue with you?

Thank you for references, hope I'll be able to sort that stuff out from scratch.

Kind regards.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating multiple columns in SQLite mozaharul Questions (Windows Mobile) 4 02-21-2010 02:46 PM
A table with two columns, how to fit the colums in the table? ghale Questions (Windows Mobile) 22 08-02-2009 07:53 PM
Fixing a table collumn width,how? Cableguy Questions (Windows Mobile) 5 11-17-2008 09:43 PM
sqlite col width dennishea Questions (Windows Mobile) 1 01-20-2008 08:00 PM
table col width tvrman Questions (Windows Mobile) 8 06-16-2007 09:41 PM


All times are GMT. The time now is 05:01 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0