Hi,

How can i Hide a MenuItem from MainMenu?

like that:
menu1.visible = false;

but the menu item dont have a propertie called visible.



--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com

Re: Hide/Show MenuItem by mind_the_gap

mind_the_gap
Mon May 05 04:26:22 CDT 2008

I think you can only add and remove the .Net CF MenuItems.
Alternatively you could write your own menu.


On 5 Mai, 11:18, "Armando Rocha" <armandoro...@ifthensoftware.com>
wrote:
> Hi,
>
> How can i Hide a MenuItem from MainMenu?
>
> like that:
> menu1.visible = false;
>
> but the menu item dont have a propertie called visible.
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com


RE: Hide/Show MenuItem by srhartone

srhartone
Mon May 05 04:39:00 CDT 2008

You can't. You have to clear the menu collection then re-add them when
required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Armando Rocha" wrote:

> Hi,
>
> How can i Hide a MenuItem from MainMenu?
>
> like that:
> menu1.visible = false;
>
> but the menu item dont have a propertie called visible.
>
>
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com

Re: Hide/Show MenuItem by Armando

Armando
Mon May 05 05:14:02 CDT 2008

Ok, Thanks for the help.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
> You can't. You have to clear the menu collection then re-add them when
> required.
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
> http://simonrhart.blogspot.com
>
>
> "Armando Rocha" wrote:
>
>> Hi,
>>
>> How can i Hide a MenuItem from MainMenu?
>>
>> like that:
>> menu1.visible = false;
>>
>> but the menu item dont have a propertie called visible.
>>
>>
>>
>> --
>> Armando Rocha
>> Mobile Developer
>>
>> http://www.ifthensoftware.com


Re: Hide/Show MenuItem by Armando

Armando
Mon May 05 09:56:44 CDT 2008

hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
> Ok, Thanks for the help.
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com
> "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
> news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
>> You can't. You have to clear the menu collection then re-add them when
>> required.
>> --
>> Simon Hart
>> Visual Developer - Device Application Development MVP
>> http://simonrhart.blogspot.com
>>
>>
>> "Armando Rocha" wrote:
>>
>>> Hi,
>>>
>>> How can i Hide a MenuItem from MainMenu?
>>>
>>> like that:
>>> menu1.visible = false;
>>>
>>> but the menu item dont have a propertie called visible.
>>>
>>>
>>>
>>> --
>>> Armando Rocha
>>> Mobile Developer
>>>
>>> http://www.ifthensoftware.com
>


Re: Hide/Show MenuItem by Jin

Jin
Mon May 05 11:17:35 CDT 2008

On May 5, 9:56 am, "Armando Rocha" <armandoro...@ifthensoftware.com>
wrote:
> hi,
> I put code below to remove a specific item but not work.
> any sugestion?
>
> bool status = true;
> if (status){
> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
>
> }
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com
> "Armando Rocha" <armandoro...@ifthensoftware.com> escreveu na mensagemnews:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
>
> > Ok, Thanks for the help.
>
> > --
> > Armando Rocha
> > Mobile Developer
>
> >http://www.ifthensoftware.com
> > "Simon Hart [MVP]" <srhart...@yahoo.com> escreveu na mensagem
> >news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
> >> You can't. You have to clear the menu collection then re-add them when
> >> required.
> >> --
> >> Simon Hart
> >> Visual Developer - Device Application Development MVP
> >>http://simonrhart.blogspot.com
>
> >> "Armando Rocha" wrote:
>
> >>> Hi,
>
> >>> How can i Hide a MenuItem from MainMenu?
>
> >>> like that:
> >>> menu1.visible = false;
>
> >>> but the menu item dont have a propertie called visible.
>
> >>> --
> >>> Armando Rocha
> >>> Mobile Developer
>
> >>>http://www.ifthensoftware.com

It should work since I do something similar in my code.
Just curious. What does your menu structure look like?
It appears that you're trying to remove a sub-menu item.

- Jin

Re: Hide/Show MenuItem by srhartone

srhartone
Mon May 05 13:14:01 CDT 2008

You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
desktop and device frameworks which was introduced on 2.0 and wasn't fixed in
3.5. You will have to clear the submenu collection using the Clear method.
See if this bug report on Microsoft Connect clears things up for you:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Armando Rocha" wrote:

> hi,
> I put code below to remove a specific item but not work.
> any sugestion?
>
> bool status = true;
> if (status){
> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
> }
>
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com
> "Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
> news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
> > Ok, Thanks for the help.
> >
> > --
> > Armando Rocha
> > Mobile Developer
> >
> > http://www.ifthensoftware.com
> > "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
> > news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
> >> You can't. You have to clear the menu collection then re-add them when
> >> required.
> >> --
> >> Simon Hart
> >> Visual Developer - Device Application Development MVP
> >> http://simonrhart.blogspot.com
> >>
> >>
> >> "Armando Rocha" wrote:
> >>
> >>> Hi,
> >>>
> >>> How can i Hide a MenuItem from MainMenu?
> >>>
> >>> like that:
> >>> menu1.visible = false;
> >>>
> >>> but the menu item dont have a propertie called visible.
> >>>
> >>>
> >>>
> >>> --
> >>> Armando Rocha
> >>> Mobile Developer
> >>>
> >>> http://www.ifthensoftware.com
> >
>
>

Re: Hide/Show MenuItem by Armando

Armando
Tue May 06 04:51:34 CDT 2008

Hi,

I solved the problem.

Thanks Simon and Jin for the help.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:91E68A21-807D-454A-9323-628A46814CC3@microsoft.com...
> You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
> desktop and device frameworks which was introduced on 2.0 and wasn't fixed
> in
> 3.5. You will have to clear the submenu collection using the Clear method.
> See if this bug report on Microsoft Connect clears things up for you:
> https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
> http://simonrhart.blogspot.com
>
>
> "Armando Rocha" wrote:
>
>> hi,
>> I put code below to remove a specific item but not work.
>> any sugestion?
>>
>> bool status = true;
>> if (status){
>> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
>> }
>>
>>
>> --
>> Armando Rocha
>> Mobile Developer
>>
>> http://www.ifthensoftware.com
>> "Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
>> news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
>> > Ok, Thanks for the help.
>> >
>> > --
>> > Armando Rocha
>> > Mobile Developer
>> >
>> > http://www.ifthensoftware.com
>> > "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
>> > news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
>> >> You can't. You have to clear the menu collection then re-add them when
>> >> required.
>> >> --
>> >> Simon Hart
>> >> Visual Developer - Device Application Development MVP
>> >> http://simonrhart.blogspot.com
>> >>
>> >>
>> >> "Armando Rocha" wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> How can i Hide a MenuItem from MainMenu?
>> >>>
>> >>> like that:
>> >>> menu1.visible = false;
>> >>>
>> >>> but the menu item dont have a propertie called visible.
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Armando Rocha
>> >>> Mobile Developer
>> >>>
>> >>> http://www.ifthensoftware.com
>> >
>>
>>


Re: Hide/Show MenuItem by srhartone

srhartone
Wed May 07 03:50:00 CDT 2008

Great that you got it working. Do you mind telling the group how you fixed
it, regardless of whether you solved it using the solution I mentioned or not
to benefit others ;)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Armando Rocha" wrote:

> Hi,
>
> I solved the problem.
>
> Thanks Simon and Jin for the help.
>
>
> --
> Armando Rocha
> Mobile Developer
>
> http://www.ifthensoftware.com
> "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
> news:91E68A21-807D-454A-9323-628A46814CC3@microsoft.com...
> > You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
> > desktop and device frameworks which was introduced on 2.0 and wasn't fixed
> > in
> > 3.5. You will have to clear the submenu collection using the Clear method.
> > See if this bug report on Microsoft Connect clears things up for you:
> > https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
> > --
> > Simon Hart
> > Visual Developer - Device Application Development MVP
> > http://simonrhart.blogspot.com
> >
> >
> > "Armando Rocha" wrote:
> >
> >> hi,
> >> I put code below to remove a specific item but not work.
> >> any sugestion?
> >>
> >> bool status = true;
> >> if (status){
> >> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
> >> }
> >>
> >>
> >> --
> >> Armando Rocha
> >> Mobile Developer
> >>
> >> http://www.ifthensoftware.com
> >> "Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
> >> news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
> >> > Ok, Thanks for the help.
> >> >
> >> > --
> >> > Armando Rocha
> >> > Mobile Developer
> >> >
> >> > http://www.ifthensoftware.com
> >> > "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
> >> > news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
> >> >> You can't. You have to clear the menu collection then re-add them when
> >> >> required.
> >> >> --
> >> >> Simon Hart
> >> >> Visual Developer - Device Application Development MVP
> >> >> http://simonrhart.blogspot.com
> >> >>
> >> >>
> >> >> "Armando Rocha" wrote:
> >> >>
> >> >>> Hi,
> >> >>>
> >> >>> How can i Hide a MenuItem from MainMenu?
> >> >>>
> >> >>> like that:
> >> >>> menu1.visible = false;
> >> >>>
> >> >>> but the menu item dont have a propertie called visible.
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Armando Rocha
> >> >>> Mobile Developer
> >> >>>
> >> >>> http://www.ifthensoftware.com
> >> >
> >>
> >>
>

Re: Hide/Show MenuItem by Armando

Armando
Wed May 07 04:22:33 CDT 2008

Ok Simon,

The solution i find to remove a specific MenuItem.

I have a Menu structure like that:

- MainMenu

- MenuItem1 [0] - index

- MenuItem2 [1]
- SubItem1 [3]
- Subitem2 [2]
- SubItem3 [1]
- License [0]

In my MainForm Initialize i have a bool parameter (Licensed? Yes/Not):

if (cAppSettings.Licensed){
//I remove the License SubMenu
MenuItem mItem = mainMenu.MenuItems[1].MenuItems[0];
mainMenu.MenuItems[1].MenuItems.Remove(mItem);
}

Its work.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:4AD5FCD3-5CDD-40A5-A242-B57FF1BC41B9@microsoft.com...
> Great that you got it working. Do you mind telling the group how you fixed
> it, regardless of whether you solved it using the solution I mentioned or
> not
> to benefit others ;)
> --
> Simon Hart
> Visual Developer - Device Application Development MVP
> http://simonrhart.blogspot.com
>
>
> "Armando Rocha" wrote:
>
>> Hi,
>>
>> I solved the problem.
>>
>> Thanks Simon and Jin for the help.
>>
>>
>> --
>> Armando Rocha
>> Mobile Developer
>>
>> http://www.ifthensoftware.com
>> "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
>> news:91E68A21-807D-454A-9323-628A46814CC3@microsoft.com...
>> > You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
>> > desktop and device frameworks which was introduced on 2.0 and wasn't
>> > fixed
>> > in
>> > 3.5. You will have to clear the submenu collection using the Clear
>> > method.
>> > See if this bug report on Microsoft Connect clears things up for you:
>> > https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
>> > --
>> > Simon Hart
>> > Visual Developer - Device Application Development MVP
>> > http://simonrhart.blogspot.com
>> >
>> >
>> > "Armando Rocha" wrote:
>> >
>> >> hi,
>> >> I put code below to remove a specific item but not work.
>> >> any sugestion?
>> >>
>> >> bool status = true;
>> >> if (status){
>> >> mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
>> >> }
>> >>
>> >>
>> >> --
>> >> Armando Rocha
>> >> Mobile Developer
>> >>
>> >> http://www.ifthensoftware.com
>> >> "Armando Rocha" <armandorocha@ifthensoftware.com> escreveu na mensagem
>> >> news:0388E14F-8D5E-4BC3-9261-5D0623186E22@microsoft.com...
>> >> > Ok, Thanks for the help.
>> >> >
>> >> > --
>> >> > Armando Rocha
>> >> > Mobile Developer
>> >> >
>> >> > http://www.ifthensoftware.com
>> >> > "Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
>> >> > news:E66CA464-E6AB-44D6-A296-E18F8BA6743F@microsoft.com...
>> >> >> You can't. You have to clear the menu collection then re-add them
>> >> >> when
>> >> >> required.
>> >> >> --
>> >> >> Simon Hart
>> >> >> Visual Developer - Device Application Development MVP
>> >> >> http://simonrhart.blogspot.com
>> >> >>
>> >> >>
>> >> >> "Armando Rocha" wrote:
>> >> >>
>> >> >>> Hi,
>> >> >>>
>> >> >>> How can i Hide a MenuItem from MainMenu?
>> >> >>>
>> >> >>> like that:
>> >> >>> menu1.visible = false;
>> >> >>>
>> >> >>> but the menu item dont have a propertie called visible.
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Armando Rocha
>> >> >>> Mobile Developer
>> >> >>>
>> >> >>> http://www.ifthensoftware.com
>> >> >
>> >>
>> >>
>>