Hi Bruce, I'm not trying to get you to change how you are doing things; this doesn't matter on the scale you're working with, but I thought I should mention that arrays are much much faster than using a dictionary. with an array only a memory address needs to be calculated, and it's a simple calculation based on the index number used (ok, with an interpreter and these types of arrays it's a little more than that), but each interaction with a dictionary entry requires a complete COM transaction, with relatively *huge* amounts of overhead. we're talking fractions of a second no matter which you use, given a collection of a dozen or so items instead of half a million. but move up to half a million, and you'll become a believer in arrays. good luck, Chip
_____ From: BT [mailto:[email protected]] Sent: Friday, May 27, 2011 4: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 Specialist GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team. -- Aaron Smith Web Development * App Development * Product Support Specialist GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team.
