EA Programing => ปัญหาที่พบในการเขียน EA => Topic started by: Hroyjank on กรกฎาคม 23, 2014, 09:45:05 am
-
รบกวนแอดมินและเพื่อนๆด้วยครับ
ปัญหาก็คือผมอยากเปลี่ยนสีของ text ตรง input แตมันไม่ยอมเปลี่ยน จะเป็นสีดำตลอด
ข้างล่างเป็นคำสั่งที่ผมย่อมาครับ ผมจะเอาพวก Alert_Color, Defualt_Color, Alert_Color ไปใส่แทน Gold Green Red
แตมันไม่ยอมเปลี่ยน แต่ว่าพวก Font_SIZE ,Font_TYPE นี่เปลียนได้ปกติครับ แต่ทำไมพอเป็นพวกสีถึงไม่ยอมเปลี่ยน
ซึ่งถ้าผมใส่ค่าสีไปเลยโดยที่ไม่ต้อง input ค่าสีมาตัว indi ก็ทำงานปกติ Font_SIZE ,Font_TYPEก็ปกติได้
ไม่ทราบว่าจะแก้ยังไงครับ
extern int Font_SIZE = 15;
extern string Font_TYPE ="Comic Sans MS";
extern int BarsShift_Side = 15;
extern int BarsShift_UP_DN = 1;
extern int WindowToUse = 0;
extern string Position_on_display = "Upper left=0 Upper right=1 Lower left=2 Lower right=3";
extern int Please_select_a_Position_on_display = 1;
extern string Alert_Color = "Gold";
extern string Defualt_Color = "Green";
extern string Alert_Color = "Red";
-------
CreateTEXT_PipsLabel( "PipsLabel",BarsShift_UP_DN,400+BarsShift_Side);
{
ObjectSetText( "PipsLabel","Pips", Font_SIZE,Font_TYPE, Gold); //ใส่ Text_Color แทน Gold
}
CreateTEXT_Pips( "Pips",30+BarsShift_UP_DN,400+BarsShift_Side);
if(AllPips>0)
{
ObjectSetText( "Pips",AllPips, Font_SIZE,Font_TYPE, Green); //ใส่ Defualt_Color แทน Green
}
else
{
ObjectSetText( "Pips",AllPips, Font_SIZE,Font_TYPE, Red); //ใส่ Alert_Color แทน Red
}
-
ให้ใส่ clr หน้าชื่อสีเดิมเพิ่มครับเช่นจาก
Red เป็น clrRed ครับ
-
ผมใส่ตามที่ท่านแอดมินบอก แบบนี่ครับ
extern string Alert_Color = "Gold";
extern string Defualt_Color = "Green";
extern string Alert_Color = "Red";
-----
CreateTEXT_PipsLabel( "PipsLabel",BarsShift_UP_DN,400+BarsShift_Side);
{
ObjectSetText( "PipsLabel","Pips", Font_SIZE,Font_TYPE, clrGold); //ใส่ clr หน้า Gold
}
แต่ไม่สามรถเปลี่นสีที่ input ได้ครับ
รบกวนท่านแอดมินช่วยแนะนำอีกครั้งครับ ขอบคุณครับ
-
extern string Alert_Color = "Gold";
เปลี่ยนเป็น
extern string Alert_Color = "clrGold";
ObjectSetText( "PipsLabel","Pips", Font_SIZE,Font_TYPE, Alert_Color);
-
ไดัแล้วครับขอบคุณครับ ขอถามต่ออีกนิดครับ
ถ้าจะให้สามารถเลือก Font_SIZE, Font_TYPE ได้โดยไม่ต้องพิมพ์เหมือนกับเลือกสีต้องใส่ค่ายังไงครับ
extern int Font_SIZE = 40; // ต้องการเลือก Font_SIZE
extern string Font_TYPE = "Arial"; // ต้องการเลือก Font_TYPE
extern color Text_Color = "clrGold"; //ตรงนี่เลือกสีได้แล้ว
-----
CreateTEXT_PipsLabel( "PipsLabel",BarsShift_UP_DN,400+BarsShift_Side);
{
ObjectSetText( "PipsLabel","Pips", Font_SIZE,Font_TYPE, Alert_Color);
}