Context Menu and Tree View.

Discussion in 'Questions (Windows Mobile)' started by RandomCoder, Feb 17, 2008.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Is it possible to add a context menu to a tree view?

    My tree view control is on a panel, on the desktop I can add the context menu to the panel and it works OK.
    But on the device the tree view blocks the context menu (as documented in the help file).
    Adding the context menu to the tree view gives the error message shown in the attachment....

    If this is not possible at this time, will it be added in the future?

    Thanks,
    RandomCoder
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    You should use the ControlRef property to pass a library control to a library method.
    Try:

    FrmLibMain.Add(TreeViewInbox.ControlRef,...)
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I'm not sure that I completely understand as I'm still unable to make this work.
    Using Msgbox( TreeViewInbox.ControlRef ) returns nothing after the treeview has been created :confused:

    Regards,
    RandomCoder
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Msgbox(Tree.ControlRef) doesn't display anything as ControlRef is not a string but rather a reference to the control.
    Did you try:
    FrmLibMain.AddContextMenu(TreeViewInbox.ControlRef,...)

    It should work properly.
     
  5. RandomCoder

    RandomCoder Well-Known Member Licensed User

    It's working

    Fantastic!
    Thanks Erel, it works perfectly.

    My mistake was that in your first post you said to try FrmLibMain.Add(TreeViewInbox.ControlRef,...)
    when infact I actually needed FrmLibMain.AddContextMenu(TreeViewInbox.ControlRef ,...) as pointed out in your last post.

    Kind Regards,
    RandomCoder
     
Loading...