Difference between revisions of "IAdeUICallbacks"

(rename of interface)
m (Inserted a previous page, so changed back link in footer)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:ADE Classes]]
 
[[Category:ADE Classes]]
<< [[Analytica Decision Engine (ADE) API]]
+
[[Category:ADE User Guide]]
 +
<languages />
 +
<translate>
 +
<!--T:1-->
 +
[[ADE User Guide]] > [[ADE Server Class Reference]] >
  
''New to [[What's new in Analytica 4.6?|ADE 4.6]]''
+
<!--T:2-->
 +
''New to [[Analytica 4.6|ADE 4.6]]''
  
= interface IAdeUICallbacks (ADE) =
+
<!--T:3-->
 +
This interface allows you to implement callbacks that are called when Analytica functions requiring user input are evaluated. You can implement these callbacks to support these user interface interactions in your own application. In many cases, the name of each method corresponds fairly directly with the name of the Analytica function that produces the user interaction.
  
An application can implement this interface (as a COM interface) in order to intercept evaluations of the [[MsgBox]] function in expressions.  This provides an opportunity for a program that uses ADE to display message boxes during evaluation in its interface.
+
<!--T:4-->
 +
When your application does not implement this interface, most of the functions requiring user interaction will do nothing when evaluated in ADE.
  
 +
<!--T:5-->
 +
The "IAde" prefix stands for "Interface ADE".  Your own code can define a class that subclasses this interface and implements its method, and then pass it to [[CAEngine::SetCallbackObject]].
 +
 +
<!--T:6-->
 
To use this, your program must implement a COM class with each of the messages, such as the '''MsgBox''' method.  As a COM class, it will implement the '''QueryInterface''' method from ''IUnknown'', and its '''QueryInterface''' method must report that it implements this interface.  You then instantiation an instance of the class and pass a pointer to that object to [[CAEngine::SetCallbackObject]].
 
To use this, your program must implement a COM class with each of the messages, such as the '''MsgBox''' method.  As a COM class, it will implement the '''QueryInterface''' method from ''IUnknown'', and its '''QueryInterface''' method must report that it implements this interface.  You then instantiation an instance of the class and pass a pointer to that object to [[CAEngine::SetCallbackObject]].
  
== Methods ==
+
== Methods == <!--T:7-->
 +
=== long [[IAdeUICallbacks::MsgBox|MsgBox]]([in] string title, [in] string text, [in] long buttons)===
 +
Called when [[MsgBox]]() is evaluated.
 +
=== bool [[IAdeUICallbacks::ShowProgressBar|ShowProgressBar]]([in] string title, [in] string text, [in] double p)===
 +
Called when [[ShowProgressBar]]() is evaluated.
 +
=== void [[IAdeUICallbacks::HideProgressBar|HideProgressBar]]()===
 +
 
 +
Called when progress bar should be hidden, for example when the computation of the requested result has completed.
 +
=== string [[IAdeUICallbacks::AskMsgText|AskMsgText]]([in] string question, [in] string title, [in] long maxText, [in] string defaultText, [in] bool bPassword, [out] bool *bCancel)=== <!--T:8-->
 +
Called when [[AskMsgText]]() is evaluated.
 +
 
 +
=== double [[IAdeUICallbacks::AskMsgNumber|AskMsgNumber]]([in] string question, [in] BSTR title, [in] bool bShowDefault, [in] double defaultNumber, [out] bool* bCancel)=== <!--T:9-->
 +
Called when [[AskMsgNumber]]() is evaluated.
  
=== LONG MsgBox(string title, string text, long buttons) ===
+
=== long [[IAdeUICallbacks::AskMsgChoice|AskMsgChoice]](([in] string question, [in] string title, [in] array<string> optionList, [in] long defaultPosition, [in] bool bShowAll, [out] bool * bCancel)=== <!--T:10-->
  
Called when the [[MsgBox]] function is evaluated.  You implement this method and can display a message box or other feedback to your end-user. The return value indicates what button was pressed to terminate the message box, as follows:
+
<!--T:11-->
 +
Called when [[AskMsgChoice]]() is evaluated, with a [[Choice]]-style control specified.
  
* 1 = OK
+
=== string [[IAdeUICallbacks::AskMsgComboBox|AskMsgComboBox]]([in] string question, [in] string title, [in] array<string> optionList, [in] string defaultText, [in] bool bShowAll, [out] bool* bCancel, [out] bool* bAllSelected)=== <!--T:12-->
* 2 = Cancel
+
Called when [[AskMsgChoice]]() is evaluated, with a combo-box style control specified.
* 3 = Abort
+
=== string [[IAdeUICallbacks::GetFilename|GetFilename]]([in] string function, [in] string defaultName, [in] string directory, [in] string extensions, [in] string caption, [in] [[CAObject]]* callingIdent, [in] int flags)===
* 4 = Retry
+
Called when [[ReadTextFile]](), [[SpreadsheetOpen]](), [[ReadImageFile]]() or [[ReadExportFile]]() is called, and needs to ask for a filename. You would generally display a file-open dialog here, or in a web-app, a file-upload prompt. You should return a full path to the file.
* 5 = Ignore
+
* 6 = Yes
+
* 7 = No
+
  
The «buttons» parameter has the following values:
+
=== void [[IAdeUICallbacks::FileOpenCompleted|FileOpenCompleted]]([in] string function, [in] string fullFilePath)=== <!--T:13-->
 +
Called when the file requested in the call to [[IAdeUICallbacks::GetFilename]] has been fully read. If you created a temporary file for the read (e.g., if the user uploaded a file), you can delete that temporary here.
 +
=== void [[IAdeUICallbacks::ShowPdfFile|ShowPdfFile]]([in] string filepath, [in] string bookmark, [in] bool bSearch, [in] bool bBookmarks)===
 +
Called when [[ShowPdfFile]]() is evaluated.
 +
=== void [[IAdeUICallbacks::OpenURL|OpenURL]]([in] string url, [in] string window, [in] string specs)===
 +
Called when [[OpenURL]]() is evaluated.
  
* 0 = OK only
 
* 1 = OK and Cancel [Default]
 
* 2 = Abort, Retry and Ignore
 
* 3 = Yes, No and Cancel
 
* 4 = Yes and No
 
* 5 = Retry and Cancel
 
  
which are then added to one of these values:
+
=See Also= <!--T:14-->
* 0 = no icon
+
{| style="margin: 1em auto 1em auto;width: 100%;border:0;table-layout: fixed;" cellpadding=5
* 16 = Critical
+
|- style="text-align: center"
* 32 = Question
+
|  [[CAFiller]]  <-  ||  [[IAdeUICallbacks]] || ->
* 48 = Exclamation
+
|}
* 64 = Information
+
</translate>

Latest revision as of 21:21, 28 July 2017

Other languages:
English • ‎中文

ADE User Guide > ADE Server Class Reference >

New to ADE 4.6

This interface allows you to implement callbacks that are called when Analytica functions requiring user input are evaluated. You can implement these callbacks to support these user interface interactions in your own application. In many cases, the name of each method corresponds fairly directly with the name of the Analytica function that produces the user interaction.

When your application does not implement this interface, most of the functions requiring user interaction will do nothing when evaluated in ADE.

The "IAde" prefix stands for "Interface ADE". Your own code can define a class that subclasses this interface and implements its method, and then pass it to CAEngine::SetCallbackObject.

To use this, your program must implement a COM class with each of the messages, such as the MsgBox method. As a COM class, it will implement the QueryInterface method from IUnknown, and its QueryInterface method must report that it implements this interface. You then instantiation an instance of the class and pass a pointer to that object to CAEngine::SetCallbackObject.

Methods

long MsgBox([in] string title, [in] string text, [in] long buttons)

Called when MsgBox() is evaluated.

bool ShowProgressBar([in] string title, [in] string text, [in] double p)

Called when ShowProgressBar() is evaluated.

void HideProgressBar()

Called when progress bar should be hidden, for example when the computation of the requested result has completed.

string AskMsgText([in] string question, [in] string title, [in] long maxText, [in] string defaultText, [in] bool bPassword, [out] bool *bCancel)

Called when AskMsgText() is evaluated.

double AskMsgNumber([in] string question, [in] BSTR title, [in] bool bShowDefault, [in] double defaultNumber, [out] bool* bCancel)

Called when AskMsgNumber() is evaluated.

long AskMsgChoice(([in] string question, [in] string title, [in] array<string> optionList, [in] long defaultPosition, [in] bool bShowAll, [out] bool * bCancel)

Called when AskMsgChoice() is evaluated, with a Choice-style control specified.

string AskMsgComboBox([in] string question, [in] string title, [in] array<string> optionList, [in] string defaultText, [in] bool bShowAll, [out] bool* bCancel, [out] bool* bAllSelected)

Called when AskMsgChoice() is evaluated, with a combo-box style control specified.

string GetFilename([in] string function, [in] string defaultName, [in] string directory, [in] string extensions, [in] string caption, [in] CAObject* callingIdent, [in] int flags)

Called when ReadTextFile(), SpreadsheetOpen(), ReadImageFile() or ReadExportFile() is called, and needs to ask for a filename. You would generally display a file-open dialog here, or in a web-app, a file-upload prompt. You should return a full path to the file.

void FileOpenCompleted([in] string function, [in] string fullFilePath)

Called when the file requested in the call to IAdeUICallbacks::GetFilename has been fully read. If you created a temporary file for the read (e.g., if the user uploaded a file), you can delete that temporary here.

void ShowPdfFile([in] string filepath, [in] string bookmark, [in] bool bSearch, [in] bool bBookmarks)

Called when ShowPdfFile() is evaluated.

void OpenURL([in] string url, [in] string window, [in] string specs)

Called when OpenURL() is evaluated.


See Also

CAFiller <- IAdeUICallbacks ->
Comments


You are not allowed to post comments.