SetInteger

Provides simplified access to the functions of API MQL5 ObjectSetInteger() to change properties with integer values (with types bool, char, uchar, short, ushort, int, uint, long, ulong, datetime, color) bound to an instance of the class graphic.There are two versions of a function call:

修飾語なしでのプロパティ値の設定

bool  SetInteger(
  ENUM_OBJECT_PROPERTY_INTEGER   prop_id,    // 整数型プロパティの識別子
  long                          value        // 値
  )

パラメータ

prop_id

[in] オブジェクトの整数型グラフィックプロパティの識別子

value

[in]  整数型プロパティの新しい値

修飾子を使用してのプロパティ値の設定

bool  SetInteger(
  ENUM_OBJECT_PROPERTY_INTEGER   prop_id,      // 整数型プロパティの識別子
  int                            modifier,    // 修飾子
  long                          value        // 値
  )

パラメータ

prop_id

[in] オブジェクトの整数型グラフィックプロパティの識別子

modifier

[in]  整数型修飾子(インデックス)

value

[in]  プロパティの新しい整数値

戻り値

成功の場合は true、整数型プロパティが変更できなかった場合は false

例:

//--- CChartObject::SetInteger の例  
#include <ChartObjects\ChartObject.mqh>  
//---  
void OnStart()  
 {  
  CChartObject object;  
  //--- チャートオブジェクトの新しい色を設定する
  if(!object.SetInteger(OBJPROP_COLOR,clrRed))  
    {  
    printf("Set integer property error %d",GetLastError());  
    return;  
    }  
  for(int i=0;i<object.LevelsCount();i++)  
    {  
    //--- レベルの幅を設定する
    if(!object.SetInteger(OBJPROP_LEVELWIDTH,i,i))  
       {  
        printf("Set integer property error %d",GetLastError());  
        return;  
       }  
    }  
 }