Input

Modified on 2017/08/06 06:35 by Eugene — Categorized as: Community Components

Syntax

public static string Input(this WealthScript obj) public static string Input(this WealthScript obj, string prompt) public static string Input(this WealthScript obj, string prompt, string title, string defaultText, int HPos, int VPos)

public static string Input() public static string Input(string prompt) public static string Input(string prompt, string title, string defaultText, int HPos, int VPos)


Parameter Description

(optional) promptDialog prompt
(optional) titleDialog window title
(optional) HPosDistance in pixels of the left edge of the dialog box from the left edge of the screen
optional) VPosDistance in pixels of the upper edge of the dialog box from the top of the screen
(optional) promptThe message to be displayed in the dialog box

Description

Displays an input dialog where the user can enter a value, which is always returned as a string type, that is returned by the function. The 2 overloaded calls provide a number of optional parameters to customize the dialog.

For ease of use, Input is a static wrapper function for .NET's Interaction.InputBox method found in Microsoft.VisualBasic namespace.

Example

This example illustrates how to use the Input function to manually specify several symbols and find the DataSets they can be found in:

Example using C# extension methods + Legacy syntax (commented out):

using System; using System.Windows.Forms; using System.Collections; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab;

namespace WealthLab.Strategies { public class SearchForClickedSymbol : WealthScript { protected override void Execute() { ClearDebug(); DataSourceManager dm = new WealthLab.DataSourceManager(); dm.RootPath = Application.UserAppDataPath + @"\Data\";

string s = string.Empty; string[] symbols = this.Input().ToUpper().Split(',', ';', ' '); //string[] symbols = Community.Components.Utility.Input().ToUpper().Split(',', ';', ' '); foreach( string sym in symbols ) s += String.Concat( sym, "," ); PrintDebug("Searching for " + s + "..." ); foreach(DataSource ds in dm.DataSources) { foreach (string str in symbols) if (ds.Symbols.Contains(str)) PrintDebug( "Found " + str + " in " + ds.Name ); } } } }