David,

    You had mentioned a huge list, besides the dictionary I mentioned. If you 
have a list no longer than 999 items per level, you can have 1000 lists of 1000 
items and that would ring the number to one million. As I did below, when doing 
a mod and coming up with 0 if mod 1000 you are at the top of a sub level if the 
result is 0. And if you divide by 1000 you get the value from 0 to 999 of the 
column number, using 0 as the base value.
    So, you can have a million items, or 999 items inside of 999 columns. So, 
you have lots of data possible.

    Below are the tree view events which also look at the ID tag I made for the 
data and the mod function is used based on the sub level.
    I commented out some test stuff while making the checks. Also at the end 
before the Main Proc select statements I exit if the treeview events are 
triggered.

Function MainDialogProc(dObj, dEvent, dId, dControl)
 ' The main menu for the Uninstall program.
 ' Below are all the events to watch to make any changes.
 ' First we must notify the event queue that no event processing has taken 
place.
 MainDialogProc = False
' Speak " dId: " & dId
' Speak " dId: " & dId
' Speak " dEvent: " & dEvent
 If dEvent = treeviewKeyDown Then
'  Set TV_Obj = myMainDialog
  TV_KeyDown = True
  myTV_KeyConnection = ConnectEvent( Keyboard, "OnKeyProcessedUp", 
"OnKeyProcessedUp")
 End If
 If dEvent = treeviewClicked Then
'  Set TV_Obj = myMainDialog
  TV_MouseDown = True
  myTV_MouseConnection = ConnectEvent( Mouse, "OnButtonUp", "OnButtonUp")
 End If
 If dEvent = treeviewSelectionChange Or dEvent = treeviewClicked Then 'Or 
dEvent = treeviewItemExpanded Then
  Set TV_Obj = dControl.selected
  Set TV_ObjControl = dControl
  TV_Name = TV_Obj.Text
  TV_Data = TV_Obj.Data
' Store all data into an array for later use:
  TV_Array(1) = TV_Data
 If TV_Data < 1000 Then
  TV_Array(0) = " Program Name: " & TV_Name
  If TV_Data > 0 Then myMainDialog.Control( "btn_add").Enabled = True
  If TV_Data > 1 Then myMainDialog.Control( "btn_delete").Enabled = True
  ' Only use this if you want to expand the item when selected.
  If TV_Data = 0 Then
   If Not TV_Obj.Expanded Then TV_Obj.Expanded = True
   Set TV_Items = TV_Obj.Children
'Speak " Item: " & TV_Items.Item(1).Text, speakerVoice
   TV_Items.Item(1).ScrollTo
   TV_Items.Item(1).Selected = True
  End If
 Else
  'TV_Data > 1000
  myMainDialog.Control( "btn_add").Enabled = False
  myMainDialog.Control( "btn_delete").Enabled = False

'Note: this is the top of the sub level, or first node in a branch, a parent.
' So to get any sub level you have to get's it children.
' If not the parent, find the parent to get that child.
  If TV_Data Mod 1000 = 0 Then
   Set TV_Items = TV_Obj.Children
  Else
   Set TV_Items = TV_Obj.ParentItem.Children
  End If
  ' Assuming the name is second child.
' The call below is referencing a known position, in a fixed list of known 
items.
  Set TV_ItemsChild = TV_Items.Item( TV_DisplayNameItemNum)
  TV_Array(0) = TV_ItemsChild.Text
  ' Fetch the property count.
  TV_Count = TV_Items.Count
  ' Fetch the name of item selected.
  If TV_Data Mod 1000 > 0 Then Set TV_ItemsChild = TV_Items.Item( TV_Data Mod 
1000)
  TV_Name = TV_ItemsChild.Text
  ' Fetch the uninstall program in position 6.
  Set TV_ItemsChild = TV_Items.Item( TV_UninstallItemNum)
  TV_UnInstall = TV_ItemsChild.Text
  TV_Array(2) = TV_UnInstall 
  ' Fetch the quiet uninstall program in position 7.
  Set TV_ItemsChild = TV_Items.Item( TV_QuietUninstallItemNum)
  TV_QuietUnInstall = TV_ItemsChild.Text
  TV_Array(3) = TV_QuietUnInstall 
'Speak " Uninstall: " & TV_Array(2) & " quiet: " & TV_Array(3), speakerVoice
  ' Set the UnInstall and QuietUninstall buttons to enabled.
  If TV_UnInstall <> "" Then 
   myMainDialog.Control( "btn_uninstall").Enabled = True
  Else
   myMainDialog.Control( "btn_uninstall").Enabled = False
  End If
  If TV_QuietUnInstall <> "" Then 
   myMainDialog.Control( "btn_quietuninstall").Enabled = True
  Else
   myMainDialog.Control( "btn_quietuninstall").Enabled = False
  End If
 End If
  ' Only use this if you want to expand the item when selected.
  If dEvent = treeviewClicked And TV_Data Mod 1000 = 0 Then TV_Obj.Expanded = 
Not TV_Obj.Expanded 
  dControl.selected.ScrollTo
  dControl.Visible = True
   MainDialogProc = True
   Exit Function
 End If

 If dEvent = treeviewClicked Or dEvent = treeviewKeyDown or dEvent = 
treeviewSelectionChanging Or dEvent = treeviewItemExpanded Then
   MainDialogProc = True
   Exit Function
 End If

Reply via email to