> Can such a thing be?
> Or can I put a hierarchical popup menu inside a cell of a listbox?
> Either way, where can I see an example of how to do it?
> 

I asked this same question a few months ago. Here is game plan and example 
code follows. All the code is kept in its own module with private constants.

1. CONSTRUCTION PHASE

A. in the item (window, listbox, etc) there is a CONSTRUCTCONTEXTUALMENU 
event. You build it there. I call a method which returns a menuitem.
B.   overall construction menu does : dim m as menuitem, m.append   
CreateContextMenu1, etc
C. Each of those subordinate methods does either a single line in the context 
menu or else a title with a subordinate list. For each item you need a 
constant to be able to report which item was chosen. I make the constants like :
     code_A = 100
     code_B = 200
     code_C = 300
then inside of the construction method for contextmenu B they would have 
codes 200, 201, 202,... These are put as the menu tags so you know what item 
was 
chosen.

2. ACTION PHASE
A. Next to the CONSTRUCTCONT... event there is another for action. Have a 
method in same module which catches the action - you call it from that event 
and 
throw it the menuitem.tag.
B. Its basically a case statement which looks for the codes then acts.
C. You can farm out some of them if they are too complicated to other private 
methods.


---- sample code ------------------------------------------

1B :   Create_OverallCM
   dim mSep as new menuitem
   mSep.text = "-"   //makes a separator in the menu
   M.Append   createCM1_1Show
   M.Append   mSep
   M.Append    createCM_Sort
   M.Append   mSep
   M.Append   ContextGlobal.create_AA
   M.Append   ContextGlobal.Create_BB
   M.Append   ContextGlobal.CreateNavigate
   M.Append   ContextGlobal.CreateFile
   

1C :   createCM1_1Show
   Dim k   as Integer
   Dim M As New MenuItem
   Dim submenu(4) As MenuItem
   //________________________________
   M.text="show ..."    //this is what is shown at the top level of the 
context menu
   //________________________________
   k = 0
   submenu(k) = New MenuItem
   submenu(k).Text = "all employees"
   submenu(k).Tag =   codeShow + 0
   M.Append(submenu(k))
   //________________________________
   k = k + 1
   submenu(k) = New MenuItem
   submenu(k).Text = "management only"
   submenu(k).Tag = codeShow +1
   M.Append(submenu(k))
   //________________________________
   k = k + 1
   submenu(k) = New MenuItem
   submenu(k).Text = "blue collar only"
   submenu(k).Tag = codeShow + 2
   M.Append(submenu(k))
   //________________________________
    return M
    

2A : ProcessCM ( Parameter is   Menutag as Integer (how it receives 
menuitem.tag on the other end) )
   select case MenuTag
     case     codeShow
      xxx
     case     codeShow + 1
      yyy
    case     codeShow + 2
     zzz
   //...
   end select
  
_______________________________________________
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>

Reply via email to