Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Tables - column position


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-15-2008, 10:26 PM
Knows the basics
 
Join Date: May 2007
Location: Daarsit
Posts: 92
Default Tables - column position

I've been redoing the EditableTable.sbp to be more generic (i.e. reading much of the data needed from the table data itself rather than programming it with the table design)...
But (there's always a but!) - if I resize the columns too large (or load a wide table) then the horizontal scroll bar appears. If I use it then my edit-textbox disappears off of the right hand of the screen (offset is vs. left of table, not left of displayed table).
Does anyone know of a way to read the offset of the columns from the left hand edge of the displayed table (or a way to stop resizing, or a way to locate the caret in X&Y coordinates on the form)?
Reply With Quote
  #2 (permalink)  
Old 02-15-2008, 11:03 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,030
Default

There is a method to get/set the columns Width and height, so estableshing the ofset of the selected cell should be straight foward...
Something like...

Sub Table_SelectionChanged
Textbox1.Left=TB.ColNumber(TB.SelectedCol)*TB.ColW idth(TB.SelectedCol)+1
'Textbox left value = selected Column index * The column Width + 1 to place the TextBox INSIDE the CELL
'The same Aplies to the TOP propertie...

End Sub
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #3 (permalink)  
Old 02-16-2008, 05:23 PM
Knows the basics
 
Join Date: May 2007
Location: Daarsit
Posts: 92
Unhappy Almost!

Nearly...what you have described is what I've been doing.

Consider the following:
I have a table control 500 pixels wide.
I load a table with 10 columns, each 100 pixels wide.
I scroll horizontally to column 9 & click in the cell to edit it.

If I calculate the left offset of the cell (as 900) then the edit box ends up 400 pixels to the right of the cell, in the area that the cell would have been if my control were 1000 pixels wide.
Reply With Quote
  #4 (permalink)  
Old 02-16-2008, 06:47 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,030
Default

Please up-Load the code, and I'll try to make some sense of it...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #5 (permalink)  
Old 02-16-2008, 09:45 PM
Knows the basics
 
Join Date: May 2007
Location: Daarsit
Posts: 92
Default

OK, I present an updated version of the really rather good already EditableTable1.1.
Feed it any table you like, preferably a wide one, & then use the scroll bar to move to the right. Click a cell & see if you can spot the textbox (you could make the form wider if you can't see it at all). Also try activating the textbox & then moving the scroll bar.

I've got a way to go to get this right...
Attached Files
File Type: sbp EditableTable1.2.sbp (2.0 KB, 15 views)
Reply With Quote
  #6 (permalink)  
Old 02-17-2008, 10:18 AM
klaus's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: Switzerland
Posts: 434
Awards Showcase
Competition Winner 
Total Awards: 1
Default

Hi Linecutter
I had a look at your problem and I am afraid that there is no solution at that time for the positionning of the text box.
The problem is that there is information missing:
- the x value from the beginning of the table to the first part of the first displayed column, even the ColWidth value is of no help because the table displays also a partial first column.
- the row number of the first displayed row.
- or the Values of the integrated VScrollBar and HScrollBar of the table.

As long as these values are not available you cannot position your TextBox onto a Cell.

In trying to solve your problem I found a problem with the ColWidth values.
I posted a Bug report:
http://www.basic4ppc.com/forum/showt...=9746#post9746

Best regards
Klaus
Switzerland
Reply With Quote
  #7 (permalink)  
Old 02-22-2008, 02:30 PM
klaus's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: Switzerland
Posts: 434
Awards Showcase
Competition Winner 
Total Awards: 1
Default

Hi LineCutter,
After your post in the thread
ColWidth problem in Tables

Quote:
Klaus: It seems that the scrollbar control available in ControlsEx.dll might be a workaround... if the change in column width can trigger an event so that we know when to add the control, or we accept that it needs to be there all the time & for every table event we bring the scrollbar to the front, hiding the real one if it's being displayed.
Haven't played with it yet, nor thought through the maths - that has to wait until we can tell if the total table (column) width has changed.
I have looked at it and you find joined a first solution. There is still some finetuning to do, espacilly for the device, but it works.

I am not really convinced on an editable Table like this, I prefer having a Panel with all the data for one record set available and editable, but this is just an opinion.

Hope this will help you.

Best regards.
Klaus
Switzerland
Attached Files
File Type: zip EditableTable1.4.zip (10.2 KB, 22 views)
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows position WZSun Basic4ppc Wishlist 12 06-08-2008 02:56 AM
Remove Column derez Bug Reports 1 11-01-2007 05:16 PM
Position of form designer pixelpoint Basic4ppc Wishlist 0 08-16-2007 12:51 PM
Tables J12345T Questions & Help Needed 6 07-09-2007 09:04 PM
tables Fotis Nakos Questions & Help Needed 3 04-29-2007 08:40 AM


All times are GMT. The time now is 05:51 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0