Posted 18 years ago
by Sven Thorsen
I need to be able to show a dialog when a IntelliPromptMemberListItem is selected from the list.
What i want is to display a dialog where the user can select a file, and the insert the path to that file in the syntax editor.
Ex. the user enters: "<file src=". I handle the trigger for "=" and add a new iten named "Select file...". When the user selects this item i want to show the select file dialog. When the dialog returns i want the returned file opath to be inserted in the document.
I've tried to inherit from IntelliPromptMemberListItem and overriding the AutoCompletePreText and AutoCompletePostText properties calling my ShowDialog method in the geter, but it seems the properties are never called by the syntax editor. Now how can I do it then?
This can hopefully be done in some way. I would think having a IntelliPromptMemberListItemBase class or something would be nice as the IntelliPromptMemberListItem class evidently has some internal thingamajiging that I can't get at.
Here's the code for my latest attempt at creating my own itemtype:
What i want is to display a dialog where the user can select a file, and the insert the path to that file in the syntax editor.
Ex. the user enters: "<file src=". I handle the trigger for "=" and add a new iten named "Select file...". When the user selects this item i want to show the select file dialog. When the dialog returns i want the returned file opath to be inserted in the document.
I've tried to inherit from IntelliPromptMemberListItem and overriding the AutoCompletePreText and AutoCompletePostText properties calling my ShowDialog method in the geter, but it seems the properties are never called by the syntax editor. Now how can I do it then?
This can hopefully be done in some way. I would think having a IntelliPromptMemberListItemBase class or something would be nice as the IntelliPromptMemberListItem class evidently has some internal thingamajiging that I can't get at.
Here's the code for my latest attempt at creating my own itemtype:
public class IntelliPromptMemberListDialogItem : IntelliPromptMemberListItem
{
private string _acPostText;
private string _acPreText;
private Form _dialog;
private IWin32Window _owner;
public IntelliPromptMemberListDialogItem(string text, int imageIndex, string description,
Form dialog, IWin32Window owner) : base (text, imageIndex, description, "", "")
{
_dialog = dialog;
_owner = owner;
}
public void ShowDialog()
{
_dialog.ShowDialog(_owner);
_acPreText = _dialog.Tag is string ? (string) _dialog.Tag : null;
}
public new string AutoCompletePostText
{
get
{
ShowDialog();
return _acPostText;
}
set { _acPostText = value; }
}
public new string AutoCompletePreText
{
get
{
ShowDialog();
return _acPreText;
}
set { _acPreText = value; }
}
}