diff options
author | Behrend Cornelius <bc@openoffice.org> | 2001-06-21 13:47:44 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2001-06-21 13:47:44 +0000 |
commit | a66bbd68705c3e124db01dd8ade7d867233e8173 (patch) | |
tree | f13a3da58cdfba1e520319934172dc0b8caffd39 /wizards/source/tools/Listbox.xba | |
parent | ef0f8c13fecf0dc4e008f130f5c479a26b0ad749 (diff) |
#88615# New Listbox methods inserted
Diffstat (limited to 'wizards/source/tools/Listbox.xba')
-rw-r--r-- | wizards/source/tools/Listbox.xba | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/wizards/source/tools/Listbox.xba b/wizards/source/tools/Listbox.xba index 0f69beab9..f3d56027e 100644 --- a/wizards/source/tools/Listbox.xba +++ b/wizards/source/tools/Listbox.xba @@ -268,4 +268,40 @@ Dim CurIndex as Integer Next i GetSelectedListboxItems() = SelList() End Function -</script:module>
\ No newline at end of file + + +' Note: When using this Sub it must be ensured that the +' 'RemoveItem' appears only only once in the Listbox +Sub RemoveListboxItemByName(oListbox as Object, RemoveItem as String) +Dim OldList() as String +Dim i as Integer +Dim a as Integer +Dim MaxIndex as Integer + a = 0 + MaxIndex = Ubound(oListbox.StringItemList()) + OldList = oListbox.StringItemList() + Dim NewList(MaxIndex -1) + For i = 0 To MaxIndex + If RemoveItem <> OldList(i) Then + NewList(a) = OldList(i) + a = a + 1 + End If + Next i + oListbox.StringItemList() = NewList() +End Sub + + +Function GetItemPos(oListBox as Object, sItem as String) +Dim ItemList() +Dim MaxIndex as Integer +Dim i as Integer + ItemList() = oListBox.StringItemList() + MaxIndex = Ubound(ItemList()) + For i = 0 To MaxIndex + If sItem = ItemList(i) Then + GetItemPos() = i + Exit Function + End If + Next i + GetItemPos() = -1 +End Function</script:module>
\ No newline at end of file |