Hi Jeff,

    I am re-writing the old hourly clock to include many different settings 
along with both a sleep and wakeup mode.
    I could have used many combo boxs or other sources of selection for the 
menu's but decided to use checkboxs for simple options. 
    thus, having lets say the chime to happen once an hour, every half hour, or 
every quarter hour, then there is a value to set, 1, 2, or 4 and this is used 
in the announceHour variable that is true unless shut off, or 0...

    Also there is a 12 or 24 hour format, thus saving that value, like the 
hourly, in the IniFile as 12 or 24. Now, to select one, the other has to be 
unchecked. Also, in the other there are 3 choices. Also, when having multiple 
announcements, there is a list. Granted I could have had a list to do this. but 
that also is another dialog or a menu choice; which I chose the menu.

Example:
    I am setting the menu item for the 3 chime settings stated above. I use the 
dictionary and the IniFile selection to set the one item and unchek all the 
others.

 myDialogMenu.Checked(  GetMenuItemID( dictMyChimeSettings, 
INIFile(myINIFile).Number( "Configuration", "ChimeSetting")) = SelectMenuItem( 
dictMyChimeSettings)

    Now, I have not tested that for I just wrote it during the responses to 
Aaron. I am just using the menu items without making more dialogs, the only 
reason for this.

        Bruce




  Sent: Friday, May 27, 2011 4:27 PM
  Subject: RE: Menu Items and Menu Group?


  Bruce,

   

  What are you writing an app to do?

   

  From: BT [mailto:[email protected]] 
  Sent: Friday, May 27, 2011 1:24 PM
  To: [email protected]
  Subject: Re: Menu Items and Menu Group?

   

   

  Hi Aaron,

   

      Yes, an array does offer one choice, but in my dictionaries, I have 2 
choices. Use of the ID for selection, and any value passed in from the IniFile.

      But, dictionaries are also faster, but I am not using it for that reason, 
nor even thought about it.

   

      For, my second function I wanted to get the item value out that would be 
the value for that item if selected. so an assignment would take place using 
the dictionary, along with using the dictionary as the selection nullify and 
getting/putting...

   

      Granted as an after thought, Arrays can be set up with index's that are 
not sequential, but could not remember if that was possible in VB, but like you 
say, "Different strokes for different folks."

   

      At the moment I could not find any good substitute in VB commands...

   

          Bruce

   

    Sent: Friday, May 27, 2011 4:11 PM

    Subject: Re: Menu Items and Menu Group?

     

    See see. I would have used an array, and a single routine with an on/off 
parameters, but different strokes for different folks.

    Aaron

    On 5/27/2011 4:07 PM, BT wrote: 

     

    Hi Aaron,

     

        Just got back from a quick hour break to Ithaca. I did this for one 
reason, to make a universal item function for all items and to reduce space.

     

        Yes, I could make lots of lists, lots of checks, and I reduced a lot of 
if then's to functions, in fact 2 functions...

     

        so, yes, there is a dictionary, and a list in the case statements, but 
the rest is reduced to 2 function calls.

     

        I hope that makes it easier for you to understand. You will have to 
wait until I release the app...

     

            Bruce

     

      Sent: Friday, May 27, 2011 1:54 PM

      Subject: Re: Menu Items and Menu Group?

       

      Why would you go through the trouble of creating a dictionary of all your 
menu ids, when you already know what they are based on your XML?

      Aaron

      On 5/27/2011 1:41 PM, BT wrote: 

       

      Hi Doug,

       

          After asking the question I discovered that knowing all the menu 
items and such creates a problem if different types, but a dictionary of the 
only ID's you want does prevent that problem.

       

          So, below is how I got around the issues. the first function unchecks 
all items inside the dictionary and returns a true to set the actual menu item 
that had been selected, so it gets set true.

       

          Then the second function uses the dictionary to find the ID on the 
item list to find the value of that item and return the actual menu ID of that 
particular value.

       

          So this allows me to uncheck a selection and find the ID of a value 
corresponding to that ID...

       

          So, if choices then one value selects only one item and such...

       

          You will understand it after I post the cuckoo Clock.

       

          Just going one step at a time, filling in the menu items, selections, 
and the IniFile with those selections, and the reverse.

       

              Bruce


      Function SelectMenuItem( menuDict)
       ' Uncheck all menu items and set selected one by passing back true.
       Dim mId
       For Each mId In menuDict
        myDialogMenu.Checked( mId) = False
       Next
       SelectMenuItem = True
      End Function

       

      Function GetMenuItemID( menuDict, item)
       ' Return the menuItem ID of the item inside the dictionary.
       Dim mID
       For Each mID In menuDict
        If menuDict( mID) = item Then
         GetMenuItemID = mID
         Exit Function
        End If
       Next
       GetMenuItemID = ""
      End Function

        Sent: Friday, May 27, 2011 12:00 PM

        Subject: Re: Menu Items and Menu Group?

         

        Bruce,

        We do not expose the information you are asking for.  The reason is the 
menu object we provide is for your own dialogs.  Meaning either your entry in 
our apps menu or the menu bar in your dialog.  In either case you are the one 
that put the entries in the menu so you know what is there and how to interact 
with them.

        Doug

        On 5/27/2011 10:27 AM, BT wrote: 

         

        Hi!

         

            I still would like to know, but my dictionary function is perfect 
and requires only the items dictionary along with 4 lines of code for the 
function...

                Bruce

         

          Sent: Friday, May 27, 2011 8:18 AM

          Subject: Menu Items and Menu Group?

           

           

          Hi!

           

              I discovered in my app manager in the help menu that there is no 
property for the size or count inside a menu item list. Is there?

           

              I wish to deselect or check all items inside one menu list so if 
I check one item all the rest are unchecked.

           

              I no from other languages ther is usually a way to count all 
items with a built in property and there is none for WE menu 
properties/methods. At least what I see on the property list.

           

              I attempted the UBound and that either says the method/property 
does not exist or not set...

           

              Any thoughts would be appreciated for I am at the moent making a 
dictionary list of all items to resolve the issue.

           

                  Bruce

           





-- Aaron Smith Web Development * App Development * Product Support SpecialistGW 
Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825260-489-3671 * 
gwmicro.com To insure that you receive proper support, please include all 
pastcorrespondence (where applicable), and any relevant informationpertinent to 
your situation when submitting a problem report to the GWMicro Technical 
Support Team.



-- Aaron Smith Web Development * App Development * Product Support SpecialistGW 
Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825260-489-3671 * 
gwmicro.com To insure that you receive proper support, please include all 
pastcorrespondence (where applicable), and any relevant informationpertinent to 
your situation when submitting a problem report to the GWMicro Technical 
Support Team.

Reply via email to