Posted 20 years ago
by Boyd
-
Sr. Software Developer,
Patterson Consulting, LLC
Is there an easy way to determine if an item is already in the IntelliPromptMemberList based purely on the text that is displayed?
Here's the background. I'm trying to build a list of members for a VBScript editor. I start with global scope and work in towards the most local scope. For instance... I add global variables, then I add script variables, then I add function variables. The trick is that a function variable of the same name should hide any variables in a wider scope (like a global or script variable). The IntelliPromptMemberListItem that would be added for each of these entries is entirely difference except for the Text property.
The 'Contains' method takes an IntelliPromptMemberListItem object. Since these two objects are different, I wouldn't expect it to find a match based on text alone since icon and description would be different.
Is there an efficient way to check if a member item with the same text already exists? My first thought would be to enumerate each one and do a string comparison on the name to look for a match. My second thought would be to build a hash table of IntelliPromptMemberListItem objects where the Text is the key. When the hash table is complete, I could use the 'AddRange' method to get the values from the hash table into the MemberList.
Just thought I'd bounce this idea off of anyone who might have faced and tackled a similar situation.
Here's the background. I'm trying to build a list of members for a VBScript editor. I start with global scope and work in towards the most local scope. For instance... I add global variables, then I add script variables, then I add function variables. The trick is that a function variable of the same name should hide any variables in a wider scope (like a global or script variable). The IntelliPromptMemberListItem that would be added for each of these entries is entirely difference except for the Text property.
The 'Contains' method takes an IntelliPromptMemberListItem object. Since these two objects are different, I wouldn't expect it to find a match based on text alone since icon and description would be different.
Is there an efficient way to check if a member item with the same text already exists? My first thought would be to enumerate each one and do a string comparison on the name to look for a match. My second thought would be to build a hash table of IntelliPromptMemberListItem objects where the Text is the key. When the hash table is complete, I could use the 'AddRange' method to get the values from the hash table into the MemberList.
Just thought I'd bounce this idea off of anyone who might have faced and tackled a similar situation.