Close
Skip to content

Tutorial 137 | How to create a form with a combo box

How to create a form with a combo box containing all the valid colors of the the color class

Tutorial 137, based on the quick-tip 26 program, creates a form with contains a combo box and a panel. The combo box holds all the valid colors for the color class. When you select a color, the program changes the panel into that color.

The tutorial program also plots a moving average. The color of the new plots are changed according to the color selected.

Using a plot of a moving average is a trivial example but should show how the color could be changed by the user interacting with a form and could be applied to more complex programs.

How the program works

When tutorial 137 is initialized the form (containing the combo box and panel) is opened and all the valid colors are loaded into a vector. A counter goes through a loop and adds the vector contents into the Combo box, one element at a time. The program also draws small rectangles for each element in the vector.

When a user chooses a color in the combo box the SelectedIndexChanged event is fired. When this occurs the color of the panel is changed to reflect the color selected. The color is also stored in a variable (PlotColor) in RGB form.

A moving average is plotted and its color is set to PlotColor.

Video explanation of tutorial 137

Download

[download_box]The tutorial 137 show-me study (_Tutorial137) is available for download for $19.95 by clicking the following link. The program works with TradeStation version 9.5 and newer versions.

. If you are a God Pass member do to the Gold Pass area below to get your free download.[/download_box]

Gold Pass area

This content is for members only.

Technical lessons

The following are some of the programming constructs used in this tutorial:

  • Drawing rectangles and changing their color
  • Using namespaces
  • Creating forms
  • Creating vectors and reading/writing data from/to them
  • Using a combo-box event

You might also be interested in:

Tutorial 135 | Creating a form to send order tickets

Quick-tip 3 | Opening a form attached to an EasyLanguage program

Please let me know if you notice any mistakes or errors or have questions.

THESE INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.