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

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

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Width in table with XML

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2010, 12:45 PM
Junior Member
 
Join Date: Sep 2009
Posts: 14
Unhappy Width in table with XML

Hi Peeps,

Setting columnwidth in a table (TblD) in this code is does not work:
All columns stay equally wide.....


bestandsnaam="\Opslagkaart\rmsgolf\rmsafstanden.xm l"
TblD.LoadXML(bestandsnaam)
TblD.ColWidth(TblD.ColName(0))=65
TblD.ColWidth(TblD.ColName(1))=65
TblD.ColWidth(TblD.ColName(2))=35
TblD.ColWidth(TblD.ColName(3))=150
TblD.Visible=True
TblD.Refresh
FrmGem.Refresh


Any suggestions anyone???
Reply With Quote
  #2 (permalink)  
Old 01-22-2010, 01:28 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by rmschreuder View Post
TblD.LoadXML(bestandsnaam)
I've only used LoadCSV() (and with no header embedded in the file), so I don't have experience of the detail of LoadXML(), but I see that it sets up the column types and presumably the names. Have you confirmed that there are names? Would the code behave as you see if the names were null?

(I've just added a SaveXML() to my code in addition to the SaveCSV(), and I see that the XML has the column names but not the widths.)

I haven't had a problem with changing a column width to zero (and back) while the table is loaded...

Mike.
Reply With Quote
  #3 (permalink)  
Old 01-22-2010, 07:15 PM
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default

Ok, thx Mike,

I will look into that.
Are the widths of columns saved if you use saveCSV method?

mike (as well)
Reply With Quote
  #4 (permalink)  
Old 01-22-2010, 08:49 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by rmschreuder View Post
Are the widths of columns saved if you use saveCSV method?
I'm pretty sure not; my code always sets the widths and headings.

Mike.
Reply With Quote
  #5 (permalink)  
Old 01-22-2010, 09:14 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hi Mike,

In CSV and XML files, the column widths are not saved. If you want to save them you must do it in a separate file. Could be interesting when the user has changed the width and wants to get the same at the next run of the program.

It looks strange that your column widths are all the same.
I have tried it with the attached test program, and it works.

Could you, perhaps, post your code so we could have a closer look at.

Why do you use XML files? Loading CSV files is faster.

Best regards.
Attached Files
File Type: sbp TableColWidth.sbp (1.7 KB, 6 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #6 (permalink)  
Old 01-25-2010, 07:33 AM
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default

Well,

I decided to switch to csv files and loadCSV as method.
Then the width of a table is settable. So I guess it is a bug, which only is there after using method LoadXML.

Answer to mjcoon: Yes there are columns; at least I see the columnheaders after loading with the correct names.

Another table problem:

I want to use the table object with different files, so I use:


If TblD.ColCount=0 Then Return
TblD.Clear
For n=0 To TblD.ColCount-1
TblD.RemoveCol(TblD.ColName(n))
Next n



I get errors on this code (not always) which i don't understand...
Anyone got the answer?
I attach code & files.
You have to change the used path to the files according to your phone and make directory rmsgolf etcetera.

Mike

mike
Attached Files
File Type: sbp testtable.sbp (1.5 KB, 5 views)
File Type: zip testtblfiles.zip (671 Bytes, 7 views)

Last edited by rmschreuder : 01-25-2010 at 08:31 AM.
Reply With Quote
  #7 (permalink)  
Old 01-25-2010, 08:18 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

In the For - Next loop you use the variable 'n' representing the column index. After each RemoveCol the indexes of the columns change, so when for example n=TblD.ColCount-1, this column doesn't exist any more.

Try this code:
For i=Table1.ColCount-1 To 0 Step -1
Table1.RemoveCol(Table1.ColName(n))
Next

In the program I posted in post #5 with:
For i=0 To Table1.ColCount-1
Table1.RemoveCol("Test"&i+1)
Next
it works because I remove the columns by their name and not by their column index.

Quote:
Well I decided to switch to csv files and loadCSV as method.
Then the width of a table is settable then. So I guess it is a bug.
I don't know why you couldn't resize the column width in your program. In the sample program in post #5 it works also with XML files !

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide

Last edited by klaus : 01-25-2010 at 08:22 AM.
Reply With Quote
  #8 (permalink)  
Old 01-25-2010, 08:34 AM
Junior Member
 
Join Date: Sep 2009
Posts: 14
Default

Ah, of course!!!!!

Thx Klaus, now I have an error free program!
I will not look into the columnwidthproblem anymore, because the xml files are larger!
You certainly do deserve your awards in my opinion...

Mike

Last edited by rmschreuder : 01-25-2010 at 08:38 AM.
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
Autoresize columns in table to fit Table Width ghale Code Samples & Tips 4 05-15-2010 12:14 PM
Fixing a table collumn width,how? Cableguy Questions (Windows Mobile) 5 11-17-2008 08:43 PM
Is it possible to set a width of the scrollbar? aeror Questions (Windows Mobile) 2 06-19-2008 10:22 AM
Pen width and XOR drawing enonod Questions (Windows Mobile) 2 06-01-2008 06:43 PM
table col width tvrman Questions (Windows Mobile) 8 06-16-2007 08:41 PM


All times are GMT. The time now is 08:35 AM.


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