When using the markgrid how can I get the columns to shift to be visible? I have 4 columns, there is content for the 5th, if I scroll to the 4th and then scroll again how can I pull the 5th column into the 4th position or something like it.? I have done this but by slicing my array again and setting the content all over. Takes time this way since it has to go thru the complete array and parse from the new location. I figure there has to be a way to pull the content from columns off screen to on screen. Any help greatly appreciated.
EDIT: Ok, so really don't know if this is the only way to shift columns to bring the content of a column into view or not but my method follows:
1. To bring the 5th column into view, set columnwith of first column to 0.
2. Set 5th column to whatever width the first column was.
Like I said, not sure if there is another method or better method, so far I have not found it.
EDIT 2: Well I thought I had it figured out based on my first edit by using the following code
m.columnFocused=m.ProgramMarkupGrid.itemFocused MOD m.ProgramMarkupGrid.numColumns
IF m.columnFocused >= 3
counter= m.columnFocused - 3
temp=[]
for i=0 to m.programmarkupgrid.numcolumns - 1
if i <= counter
temp[i]= 0 'set column width to 0
else
temp[i]= 312 'set column width to 312
end if
end for
m.programmarkupgrid.columnwidths= temp
end if
My logic is that when the user scrolls across (left to right) the grid and enters the 4th column (3rd focused item), the if statement sets the counter, in the first case it would be 0. An array (temp) is created resulting in the array [0,312,312,312,312,312,312,312]. There are total of 8 columns in the grid. So, the first column (focus 0) width is set to 0, shrinking that column so the 5th column comes into view. This works. The problem occurs as the user scrolls to column 5 (4th focused item). The counter sets to 1, so the for loop creates the array [0,0,312,312,312,312,312,312]. I have verified this multiple times with print statements, but the column is not displayed as 0. The first (0 focused) shrinks but the second (1 focused) remains 312 and the next column content is overlayed on it ending up with a column over a column. If I continue to scroll, the array continues to replace 312 with 0 from the first position on. The content continues to be pulled into view but the first column on the left side of the grid continues to be overlayed. If I scroll back (right to left) the columns "unstack". Can I get some help as to why the columns seem to stack over each other. The above code is fired from the onFocusChanged which from the debugger screen looks like it fires 2 times for each sroll position with exception of the very first. The temp array only changes once. The onFocusChanged is only present in one ObserveField and fires when itemfocused changes.
Debugger:
foucs 0
foucs 1
foucs 1
foucs 2
foucs 2
foucs 3
foucs 3 counter 0
<Component: roArray> =
[
0
312
312
312
312
312
312
312
]
foucs 0
foucs 3
foucs 3 counter 0
<Component: roArray> =
[
0
312
312
312
312
312
312
312
]
foucs 4
foucs 4 counter 1
<Component: roArray> =
[
0
0
312
312
312
312
312
312
]
foucs 0
foucs 4
foucs 4 counter 1
<Component: roArray> =
[
0
0
312
312
312
312
312
312
]