1. How can I tell if a row is a folder or a plain row?
There is no built in way to do this.
Well, in case anyone is curious, here's how I solved this one. I
exclusively use my own subclass of ListBox. These ListBoxes are used
to display data from a MySQL database. I don't really need the
CellTag feature, but a RowTag could be useful, so I consider the
CellTag(row, 0) to be the RowTag. Therefore I have two methods for
RowTag:
Sub RowTag(row as Integer, assigns v as Variant)
me.CellTag(row, 0) = v
End Sub
Sub RowTag(row as Integer) as Variant
if row >= 0 then
return me.CellTag(row, 0)
else
return 0
end if
End Sub
Since each row in the list box represents a row of data in a table,
the RowTag stores the primary key field (an integer) of the row. This
happens whenever AddRow or AddFolder is used to insert a row.
Folders represent the primary table being displayed (i.e., Groups).
Plain rows represent related records (i.e., Users). When a primary
row is added that is a folder, I simply store the key field. When a
related row is presented, I instead store the negative of the key
field. Then I'm able to determine if a row is a folder or not by
whether the RowTag is positive or negative.
Sub IsFolder(row as Integer)
return IntVal(RowTag(row)) > 0
End Sub
(IntVal is a function in my standard module that returns an Integer
from the parameter passed rather than simply a number.)
Anyway, I hope it helps someone else. It would be nice to be on the
helper side of this list for once instead of always being on the
helped side. :)
Chuck
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>