If anyone else ever wonder about this issue I looked in the source code and the index range is actually set using the getWidgetCount() which I think is wrong but nevermind. As a workaround I'm using another grid with 1 column and k rows for each column so I can have an uneven grid
On 25 נובמבר, 11:27, Ittai <etai...@gmail.com> wrote: > Hi, > I tested and saw that when the verticalPanel is created it will > receive the index values of 0 and 1. and if you add by panel.add > (widget) > a label then you will be able to use 0,1,2 > but still I have no way to manipulate the index myself > Please has anyone any idea? > > On 24 נובמבר, 18:38,Ittai<etai...@gmail.com> wrote: > > > > > Hello all, > > I have an array of strings which I divide unevenly between different > > columns of a grid (by some unrelated logic) and I need the string in > > the i place of the array to be inserted to the i place of the column. > > My grid holds one row and 6 columns and in each column I have a > > VerticalPanel which acts as my column, mainly because the columns are > > in different sizes and can change. > > What i wanted to do is something like this: > > > for (int i=0;i<array.length;i++){ > > Label labelWidget = new Label(array[i]); > > getVerticalPanelColumn().insert(labelWidget,i); //where > > getVerticalPanelColumn() is my method > > } > > > Now I noticed that the API stated that IndexOutOfBounds will be thrown > > if the index passed to insert is out of range but the problem is that > > I couldn't, for the life of me, find any way to set the range'/size/ > > capacity of the verticalPanel or to query it (and I don't mean > > widgetCount() I mean the index to which I can relate). > > So basically as a horibble workaround (which I won't use) I think I > > can add "i" null widgets to the VerticalPanel thus I believe I will > > increment the index and do my iteration but this hack is irrelevant > > for me due to the "cost" of all those null widgets addition to all my > > columns. > > Basically I would like the insert to just insert the widget at the > > closest point to i that is if i==5 and the panel holds only widget > > whose index is 1 4 7 then the insert should insert the widget between > > 4 and 7 if i==10 it should just insert it in the end and remeber its > > index is 10. > > > Has anyone encountered this? > > Isn't this some sort of bug that you have no way to set or query an > > object about the index range but you can pass it an index variable? > > > Thanks a million for any help > >Ittai-הסתר טקסט מצוטט- > > -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.