Herfried,
After the user has been authenticated, EnableMenus runs. It calls a
recursive method
Private Sub EnableMenus(ByVal authenticated As Boolean)
menuMain.MenuItems.Clear()
If authenticated Then
'menuList is a list object based on Rockford Lahotka's CSLA.NET
(
www.lhotka.net)
'it returns a list based on a table... this is the basis for my menu
list...
'Table is as follows:
'Col1: ID (int, pk)
'Col2: Text (varchar) Text of menu item
'Col3: ParentID (int) - self referential field... if = 0 then
top-level menu item (File, Edit, View, etc)
' if not = 0 then it is a "child" item of ID (so you can have
File|Open, etc)
'For simplicity, just think of menulist as a datatable and
liamMenuItem as a dataRow...
Dim menuList As LiamMenuItemList =
LiamMenuItemList.GetLiamMenuItemList()
Dim liamMenuItem As New LiamMenuItemList.LiamMenuItem
For Each liamMenuItem In menuList
Dim mi As MenuItem
mi = New MenuItem
If liamMenuItem.ParentId = 0 Then
'IF IAMMENUITEM.TEXT = &File THEN MI.TEXT SHOULD SHOW
THE VISUAL MNEMONIC
'THIS IS WHERE I AM STUCK
mi.Text = liamMenuItem.Text()
If mi.Text = "Window" Then
mi.MdiList = True
End If
If mi.Text = "Open Windows List" Then
mi.Checked = True
End If
'Load Child Menus allows n-level sub menus... called
recursively
LoadChildMenus(menuList, liamMenuItem.id, mi)
menuMain.MenuItems.Add(mi)
End If
Next
Else
'If not authenticated, just show the ability to attempt to login
again... not shown here for clarity and brevity
End If
End Sub
Private Sub LoadChildMenus(ByVal list As LiamMenuItemList, ByVal parentId As
Integer, _
ByVal owner As MenuItem)
Dim liamMenuItem As LiamMenuItemList.LiamMenuItem
For Each liamMenuItem In list
Dim mi As New MenuItem
If liamMenuItem.ParentId = parentId Then
mi.Text = liamMenuItem.Text
LoadChildMenus(list, liamMenuItem.id, mi)
AddHandler mi.Click, New System.EventHandler(AddressOf
menuMain_Click)
owner.MenuItems.Add(mi)
End If
Next
End Sub