>
In my book it's a bug. Documentation have an 32767 limit for nItemID but I don't think it applies here. Probably an internal array is kept per column ?>
On The Other Hand it doesn't need a special workaround. I always believed if I'm using listbox either I should keep the element count too low or use a RowSourceType which is kind of cursor/table.>
You're saying it's populated from an SQL but RowSourceType = 2 is alias. Why not directly use RowSourceType = 3 ? It'd let you repopulate if need be just with a 'listbox.requery()'.
I tend to use RowSourceType=3. Anyway it doesn't matter. Whenever I use a similar rowsource I never use ListIndex but directly alias.field to get what I want (any movement in listbox moves pointer in its cursor). It's shorter to code and reliable.Cetin,
If it is (or seems to be) a bug, do you know if it is reported or if MS has some to say about?
It's RowSourceType=2 because I'm not using the SQL Select as the RowSource, in fact I'm using the result cursor of a previously executed SQL Select.
Select IT_Filial, ;
IT_CodItem, ;
IT_Descr ;
From InvPrd_Itens ;
Into Cursor CurItens ;
Where IT_Filial = SelFilial ;
Order By IT_CodItem
cCadItensRowSource = "Space (2) + CurItens.IT_Filial, IT_CodItem, IT_Descr"
Think the workaround I used is what you described:
Add Object lstCadItens as cPtrListBox with Top = 28 , ;
Left = 15 , ;
Height = 340 , ;
Width = 435 , ;
RowSourceType = 2 , ;
RowSource = cCadItensRowSource, ;
ColumnCount = 3 , ;
ColumnWidths = "70, 120, 220"
. . .
Procedure cmdDetails.Click
Select CurItens
GoTo ThisForm.lstCadItens.ListIndex
wIT_Filial = SelFilial
wIT_CodItem = IT_CodItem
ShowDetails ()
EndProc
I use ListBoxes
a lot because IMO grids are very cumbersome to use and, as you can see above, in a simple Add Object I do all I want to have a simple display of itens (cPtrListBox is a class based in the ListBox class that has all properties I commonly use. BTW, I define
all my forms programatically).
Many thanks for your reply!
Fernando