Hi David,

    I was actually changing my Clipboard program to add things like the special 
folders and clicking on URL's and such this morning but did not have time to 
clean it up before leaving the house.

    So the last posting I gave you I have also changed mine. The toggle is what 
I am using and the menu item has an ID and can be called at will. The example I 
sent you before I am  again sending below also changes the display label for 
the menu item along with checking it and unchecking it. Or is you want, enable 
and un enable...
    I also changed the setting inside the .ini file as you may want to if you 
so choose.

        Bruce

Inside Dialog Callback Function:
  Case "me_space_url"
   SpacebarURL = Not SpacebarURL
   INIFile(myINIFile).Text( "Configuration", "Spacebar_URL") = SpacebarURL
   If SpacebarURL Then
    myDialogMenu.Text( "me_space_url") = "Space Bar For URL Is On"
    myDialogMenu.Checked( "me_space_url") = SpacebarURL
    Speak " Space Bar URL Is On! "
    Sleep 1000
   Else
    myDialogMenu.Text( "me_space_url") = "Space Bar For URL Is Off"
    myDialogMenu.Checked( "me_space_url") = SpacebarURL
    Speak " Space Bar URL Is Off! "
    Speak " Space Bar Move Is On! "
    Sleep 1000
   End If
   MainDialogProc = True
   Exit Function

        Bruce

  Sent: Wednesday, November 27, 2013 2:50 PM
  Subject: Re: Disabling a menu choice - how to?


  Hi David,

      Below is what Chip was talking about. Now inside the menu_ini routine you 
can set the menu to what ever condition you want.
      Inside the XML you place the Enabled="yes" or "no" for initial start 
before looking at the .ini file and settings.

      Also, you have an ID for the menu item and you can use that ID to call 
that menu item and set it as I have done below using variable SpacebarURL.
      In this example I am making a checked or unchecked, you can replace it 
with enabled=True or not enabled=False

  'Global Assignment:
  Dim SpacebarURL

  Callback for Dialog:
    Case "me_space_url"
     If SpacebarURL Then
      SpacebarURL = False
      myDialogMenu.Text( "me_space_url") = "Space Bar For URL Is Off"
      myDialogMenu.Checked( "me_space_url") = SpacebarURL
      Speak " Space Bar URL Is Off! "
      Speak " Space Bar Move Is On! "
      Sleep 1000
     Else
      SpacebarURL = True
      myDialogMenu.Text( "me_space_url") = "Space Bar For URL Is On"
      myDialogMenu.Checked( "me_space_url") = SpacebarURL
      Speak " Space Bar URL Is On! "
      Sleep 1000
     End If
     MainDialogProc = True
     Exit Function

  Creation Of Dialog:

     If dEvent = dialogCreated Then
      ' This routine is to init all main buttons and fields.
      ' Since the dialog event for creation, no menu exists, so initialize it 
now.
      Set myDialogMenu = dObj.Menu
      Set myMainEscape = Keyboard.RegisterHotkey("Escape", "ExitMenu", 
dObj.Window, dObj)
      Set myMainAltF4 = Keyboard.RegisterHotkey("Alt-F4", "ExitMenu", 
dObj.Window, dObj)
      Set myMainF5 = Keyboard.RegisterHotkey("F5", "RefreshDialog", 
dObj.Window, dObj)
      dObj.Window.Activate
  '    dObj.Window.Redraw
      Queue "MakeFileList", dObj
      Queue "SetMenu_Ini"
      MainDialogProc = True
      Exit Function

  sub SetMenu_Ini()
   INIFile(myINIFile).Text( "Configuration", "Spacebar_URL") = 
INIFile(myINIFile).Text( "Configuration", "Spacebar_URL", CStr( True))
   SpacebarURL = CBool( INIFile(myINIFile).Text( "Configuration", 
"Spacebar_URL", CStr( True)))
   myDialogMenu.Checked( "me_space_url") = SpacebarURL
   INIFile(myINIFile).Text( "Configuration", "NumLock") = 
INIFile(myINIFile).Text( "Configuration", "NumLock", CStr( False))
   myDialogMenu.Checked( "menu_NumLock") = CBool( INIFile(myINIFile).Text( 
"Configuration", "NumLock", CStr( False)))
  End Sub

    ----- Original Message -----
    From: David
    To: [email protected]
    Sent: Tuesday, November 26, 2013 9:28 PM
    Subject: Disabling a menu choice - how to?


    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