IntelliPrompt Show Problem

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Greg Shaffer - Boulder
Avatar
Hi,

I'm having an issue with showing my IntelliPrompt. I'm getting an array index out of range exception. To help me investigate the problem, could you tell me how to access the StringCollection that gets accessed in the IntelliPrompt show call?

I'm pretty sure that I am supplying a valid offset because it is less than the Document.CurrentView.Selection.EndOffset. What I did was show the IntelliPrompt at one location near the end of the document. Then I removed some text from the end of the document, added some text (less than what was removed) and displayed the intelliprompt at a smaller offset (still less than EndOffset.) Then I get the error.

Thanks,
Greg

Comments (7)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Could you email us the stack track you get so we can take a look? That might help us tell you how to narrow it down.


Actipro Software Support

Posted 16 years ago by Greg Shaffer - Boulder
Avatar
If I knew what the StringCollection is, then I think I can figure it out from my end.
Is there a way to get to it?

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Collections.Specialized.StringCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.IntelliPromptInfoTip.Show(Int32 offset)
...


Thanks,
Greg
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ahh.. just make sure your SelectedIndex property is less than the collection of items for the InfoTip before you call Show().


Actipro Software Support

Posted 16 years ago by Greg Shaffer - Boulder
Avatar
If I knew what the StringCollection is, then I think I can figure it out from my end.
Is there a way to get to it?

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Collections.Specialized.StringCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.IntelliPromptInfoTip.Show(Int32 offset)
...


Thanks,
Greg
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It's the collection that stores the formatting info for each tip. If you have multiple tips, the up and down arrows display. Like I said, the error is probably happening because the SelectedIndex is larger than the Count - 1 when you do Show().


Actipro Software Support

Posted 16 years ago by Greg Shaffer - Boulder
Avatar
Hi,

Setting the IntelliPrompt.InfoTip.SelectedIndex = 0 fixed the problem.

In future versions, it might be good to check if the SelectedIndex is out of range during a show, and either set it to zero or throw some sort of custom exception with a description.

Thanks for the tip!
Greg
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Checks will be in the next maintenance release. Thanks!


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.