Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2008, 11:36 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default MENU AND OO

Hi,

On my pursuit to improve my OO skills I have decided to try and use OO to build a menu.

Below is the menu class. I have accounted for the URL, Title, ToolTip and if the link should open on a new window or not.

However, I would like to extend this class to so that MenuLink objects had additional properties that determined which users had permission to view certain links but I am not sure how to represent the permissions in my class and also how to link the permission with the users.

Also, this class does not allow for sub menus. Is there a way to use OO to create a menu hierarchy?

Cheers

P


public class MenuLink : MenuItem
    {
        private string _Url, _Title, _ToolTip;
        private bool _IsExternal;

        public MenuLink()
        {
            _Url = "";
            _Title = "";
            _ToolTip = "";
            _IsExternal = false;
        }

        public MenuLink(string Url, string Title)
        {
            _Url = Url;
            _Title = Title;
            _ToolTip = "";
            _IsExternal = false;
        }

        public MenuLink(string Url, string Title, bool IsExternal)
        {
            _Url = Url;
            _Title = Title;
            _IsExternal = IsExternal;
            _ToolTip = "";
        }

        public MenuLink(string Url, string Title, string ToolTip, bool IsExternal)
        {
            _Url = Url;
            _Title = Title;
            _ToolTip = ToolTip;
            _IsExternal = IsExternal;
        }

        public string Url
        {
            get { return _Url; }
            set { _Url = value; }
        }

        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }

        public string ToolTip
        {
            get { return _ToolTip; }
            set { _ToolTip = value; }
        }

        // We need internal and external links.
        [XmlAttribute]
        public bool IsExternal
        {
            get { return _IsExternal; }
            set { _IsExternal = value; }
        }
    }





Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 03:28 PM
OO Advise and Clarification rodmcleay General .NET 1 October 14th, 2004 09:51 PM
Changing Menu made with VB 4 Menu Editor Zooker VB How-To 1 July 26th, 2003 11:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.