Using Key Press trigger and Memberlists

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Danny Liberty
Avatar
Hi,

I am using the Syntax Editor control to allowing displaying and editing VBScript. I want to be able to provide Intelliprompt functionality for custom defined COM objects.
I have been able to successfully do this by calling AddReflectionForTypeMembers for my type and displaying it using MemberList.Show().
But this solution does not suffice - I would like to display a different memberlist depending on the object specified to the left of the keypress trigger (for example, typing "obj1." would pop up an intelliprompt with obj1's members, and typing "obj2." would pop up a different intelliprompt list).

How can this be achieved?

Danny

[Modified at 11/13/2006 08:47 AM]

Comments (3)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Danny,

Getting IntelliPrompt working is no easy task. We provide all the user interface features for it but it is up to the developer (you) to populate that user interface.

For our .NET Languages Add-on (which currently only has C# implemented but we are working on VB.NET), we parse the document to determine what type each variable is. Then it performs reflection based on that variable type. This page gives a summary of how we achieve it:
http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/Addons/DotNet/ImplementationDetails.aspx

Even with our parser generator and other features of SyntaxEditor it still can be very time consuming to generate a grammar to parse a complex language. VBScript might not be as bad since it doesn't have the same number of constructs as full VB.NET does.

But if you'd like to completely forego building a grammar for VBScript, you could just scan backwards in your document to try and find where obj1 is declared and then determine its type from that line. Once you do that, populate the member list with the appropriate members.

Perhaps once we are done with our VB.NET language, we can work on a VBScript language since it would simply be a slimmed down version of VB.NET with some other tweaks.


Actipro Software Support

Posted 17 years ago by Danny Liberty
Avatar
Currently I'm not aiming at support for the entire VBScript languge. Only support for our custom objects should suffice. To make things even easier, I know the names of the objects in the script. I just need to know what's on the left of the '.' character. It would be useful if the KeyPress TriggerActivated event would supply this information in the TriggerEventArgs.
Is there any way I can find this out? (I could try and use the current cursor position and then do a lastindex search for a whitespace, but this doesn't seem like a very elegant solution to me...)

Danny

[Modified at 11/13/2006 01:16 PM]
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Oh we have a lot of features for text scanning. If you call Document.GetTextStream you get a TextStream which is really a slick feature. You can navigate back through tokens with it. So you can look at the token type, if it is an Identifier, then get its text and look up your object from that. Then populate the member list.

Look at the XmlDynamicSyntaxLanguage class in the sample project. That has an implementation that kicks off from a trigger which completes the current tag if you type a > character. It does token scanning, etc. That should get you started with how to use it.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.