Hi Chip,

    Yes it might, when going down the list it actually said nothing when I 
tried it before sending the example out.
    But, David could number the menu items inside his xml file in each ID by 
having a number at the end. Like: "me_item_4"

    When doing this and he disables it he also know where it was on the item 
list and when inserting the item he will have the number he needs to place it 
on the list where he wants it.
    I have not tried this but I suspect it will work. He just has to capture it 
from the xml file when the dialog is created and any .ini setting such as 
disable it is present then he can delete it from the list and capture it's item 
number on the list and insert it back at will...even store the item number 
inside the .ini file.

    Best solution I can come up with in this case without having a blank spot 
or dashes in the menu ...

        Bruce

  Sent: Wednesday, November 27, 2013 4:38 PM
  Subject: RE: Disabling a menu choice - how to?


  Bruce,



  I don't recommend setting a submenu or menu item to a space, as even if it's 
disabled, as you arrow across it window-eyes will speak "disabled"; it won't 
speak any menu item text, so I think it would be confusing to the user.  And 
this is almost as much work as deleting and inserting the menu item.



  Chip





  From: LB [mailto:[email protected]]
  Sent: Wednesday, November 27, 2013 4:21 PM
  To: [email protected]
  Subject: Re: Disabling a menu choice - how to?



  Hi David,



      Yes the menu item would still be there but, the text example I showed you 
can be set to nothing or "" and disable the menu item by setting enabled = 
False then you will have no item that is visible but a space would be on the 
list.



      You can do this or delete the item from the menu and insert it later.

      What I mentioned above allows the item to be on the list where you want 
it, but not visible, just an empty space that is disabled until you enable it, 
so if clicking on it while disabled, nothing will happen.



      When you enable it just fill in the text field with the prompt you want 
there like I showed in my example.



          Bruce



    Sent: Wednesday, November 27, 2013 4:01 PM

    Subject: Re: Disabling a menu choice - how to?



    Thanks to all who responded.



    Unfortunately, it seems things are not yet as easy as I hoped for.Smile.



    OK,   MyMenu.Enabled( "SupportByEmail") = False
      MyMenu.Grayed( "SupportByEmail") = True
    I have found a way to Grey out the menu entry, and also Disabling it:

        MyMenu.Enabled( "MyId") = False

        MyMenu.Grayed( "MyId") = True



    This all works for now, although the menu entry would still be in the list, 
when you scroll through the menu.





    Then, you informed me about the three promising methods:

        GetSubMenu,



    Delete,

    and

        InsertMenu.



    It sounded like what I wanted, and maybe it is. Yet, I did not get it to 
work.



    I tried to use the GetSubMenu to retrieve my XML defined menu entry, and 
then store it in a local variable. Thereby, I hoped to be able to quickly 
insert it at a later time, should the conditions change.



    Well, see that does not work. Why? Well, my menu entry actually is a 
submenu, holding three items. And if I do something like:

        Dim TempMenu: Set TempMenu = MyMenu.GetSubMenu( "MyID")

    ' this will sure enough store a menu object in the TempMenu.

        MyMenu.Delete( "MyID")

    ' Yep, it deletes the entry, from what I exprience.

        MyMenu.InsertMenu

    ' Hmmm, here we get in trouble. I cannot just do something like:

        MyMenu.InsertMenu( TempMenu)

    ' Why? because the InsertMenu takes three parameters, and none of them are 
an object. They are two strings, The Text and ID of the menu entry to insert, 
and then a numeric parameter. If I am to do it this way, I would have to First 
Re-initiate the menu entry, and then re-initiate the three subitems of that 
submenu, one by one. And that will be quite a lot of coding, since I would have 
to get hold of each item's Text, and their individual ID. So, unless someone 
could prove me wrong here, I guess I am better off simply to disable the 
submenu for now.



    Hope all of this makes sense. And GW, would it be possible in later 
versions of the ToolKit, to have a feature to insert a whole submenu that you 
temporarily have disabled? Or, I should have said Deleted.



    Thanks again, everyone.





      ----- Original Message -----

      From: Chip Orange

      To: [email protected]

      Sent: Wednesday, November 27, 2013 6:00 PM

      Subject: RE: Disabling a menu choice - how to?



      Rod and David,



      After reading Rod's reply, he's quite right; you could add or delete a 
menu item in the same way I was using the .enable property.  I never thought  
that could be what you meant with your question, but now that rod mentions it, 
it's just as valid an interpretation.



      I can't think of any reason why adding and deleting menu items is any 
less desirable than enabling or disabling them.



      Chip





      From: Rod Hutton [mailto:[email protected]]
      Sent: Wednesday, November 27, 2013 11:15 AM
      To: [email protected]
      Subject: Re: Disabling a menu choice - how to?



      Hello David,

      Normally, as I've learned from Chip's classes (see class 13), you check 
or uncheck menu items, and you can also disable and enable them, as necessary.

      However, having looked at the manual, it is possible to remove and insert 
menu items as well.  I've never used this approach in any of my apps, but I 
suppose it is one approach.  I've pasted the relevant info from the manual FYI.

      hth,

      Rod Hutton

      Navigation:
      The Window-Eyes Object Model
       >
      Objects
       >
      Menu
       >
      Methods
      Previous page
      Return to chapter overview
      Next page
      Menu
       object methods allow you to perform actions on a
      Menu
       object.
      Methods
      ·
      Delete
      ·
      GetSubMenu
      ·
      InsertItem
      ·
      InsertMenu
      Requirements
      Window-Eyes 7.1 or greater.

      On 11/26/13 9:28 PM, David wrote:

        Developers,

        I could need a bit of educated assistance, please.



        I have an app, that was started out by using the WEScript Framework app.



        I wanted to add a choice to the app menu of my app, and for the ease we 
will call it

            MyMenuItem.



        I entered the necessary information in the XML file, and modified the 
MenuProc function in the app code - so it knows how to handle things, once my 
new entry is selected. Everything works just like expected, this far.



        Where my knowledge stops, is here. I want to make the new menu entry 
available, only under certain conditions. Say for instance, I have a Boolean 
variable, named

            ConditionMet

        and only want to display the entry on the app menu, when this variable 
is true. Cook it all down to something like this:



            If ConditionMet Then

                ' Need the code to make the menu entry visible.

            Else

                ' need the code to make the menu entry disappear.

            End If 'ConditionMet.



        Allright, I know, it may not be all that simple. A couple of years of 
app development, has taught me there likely will need to be a few lines extra 
of codeing. Smile. Yet, I hope the above explains where my trouble has its nest.



        More exactly, which variables (properties and methods), should I make 
use of - so as to have the menu entry show up, and disappear. And, in the code, 
where would I put the extra lines. As stated, the naked frame of the app, was 
designed by WEScript Framework. So, if you happen to know exactly in which Sub 
or Function the modification will be needed, I would be saved an hour of 
searching through the lines of code. Smile.



        Thanks for any ideas and input.






------------------------------------------------------------------------------


       This email is free from viruses and malware because avast! Antivirus 
protection is active.





---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

Reply via email to