OBJ_ARROW in the text of an OBJ_BUTTON

 
Hi

I have a question ?

Is OBJ_BUTTON possible to include in the OBJ_ARROW text? And if so how?

Thanks
 
 
Keith Watford:

Use Wingdings font?



Hi Thanks

How do I enter the FONT code ?




 

Please do not reply inside quoted text box.


            ObjectSetText(obname,CharToStr(233),ArrowFontSize,"Wingdings",Colour);


            ObjectSetString(0,obname,OBJPROP_FONT,"Wingdings");

            ObjectSetInteger(0,obname,OBJPROP_COLOR,Colour);


Variations of the above should suit you although i have never used wingdings font for buttons as far as I can remember.

Obviously use your own variables and whatever wingding code you require.

 
Keith Watford:

Please do not reply inside quoted text box.


            ObjectSetText(obname,CharToStr(233),ArrowFontSize,"Wingdings",Colour);


            ObjectSetString(0,obname,OBJPROP_FONT,"Wingdings");

            ObjectSetInteger(0,obname,OBJPROP_COLOR,Colour);


Variations of the above should suit you although i have never used wingdings font for buttons as far as I can remember.

Obviously use your own variables and whatever wingding code you require.

Sorry

I corrected the code I can not THANKS

Files:
Cattura.JPG  10 kb
Cattura1.JPG  63 kb
 
  1. Please don't add text inside quoted text or SRC blocks, put it outside.

  2. Please don't post a link to or attach an image, just insert the image.

  3. Please don't post images of code or messages, copy and paste using SRC
 
Claudio Sala:

Sorry

I corrected the code I can not THANKS


      ObjectCreate(chart,nometasto,OBJ_BUTTON,0,0,0,0);
      ObjectSetInteger(chart,nometasto,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
      ObjectSetInteger(chart,nometasto,OBJPROP_ANCHOR,ANCHOR_RIGHT_UPPER);
      ObjectSetInteger(chart,nometasto,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(chart,nometasto,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(chart,nometasto,OBJPROP_XSIZE,A);
      ObjectSetInteger(chart,nometasto,OBJPROP_YSIZE,B);
      ObjectSetInteger(chart,nometasto,OBJPROP_BGCOLOR,col);
      //ObjectSetString(chart,nometasto,OBJPROP_TEXT,testo);
      ObjectSetString(chart,nometasto,OBJPROP_FONT,"Arial");
      ObjectSetInteger(chart,nometasto,OBJPROP_FONTSIZE,10);
      ObjectSetInteger(chart,nometasto,OBJPROP_COLOR,clrWhite);
      ObjectSetInteger(chart,nometasto,OBJPROP_STATE,false);
      ObjectSetInteger(chart,nometasto,OBJPROP_BACK,false);      
      
      ObjectSetText(nometasto,CharToStr(74),30,"Wingdings",Gold);

I have corrected but not SMILE OBJ_ARROW code 74

Thanks

 

For some reason

ObjectSetText(nometasto,CharToStr(74),30,"Wingdings",Gold);

will not work properly with Buttons or Edit objects.

You must modify individual parameters.

      //ObjectSetString(chart,nometasto,OBJPROP_FONT,"Arial");

      ObjectSetString(chart,nometasto,OBJPROP_FONT,"Wingdings");

      //ObjectSetInteger(chart,nometasto,OBJPROP_FONTSIZE,10);

      ObjectSetInteger(chart,nometasto,OBJPROP_FONTSIZE,30);

      //ObjectSetInteger(chart,nometasto,OBJPROP_COLOR,clrWhite);

      ObjectSetInteger(chart,nometasto,OBJPROP_COLOR,clrGold);

Also note

      ObjectSetInteger(chart,nometasto,OBJPROP_ANCHOR,ANCHOR_RIGHT_UPPER); //Does not work with buttons, will always be LEFT_UPPER

 

It looks like you're trying to put your button in the upper right-hand corner. Here is an example script of how to do it. You'll also want to add a move function so the button moves when you resize the chart window.

#property strict
#include <Controls\Button.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---
   CButton b;
   int x = (int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS);
   int y = (int)ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS);
   b.Create(0,"Button",0,x-53,2,x-3,52);
   b.Font("Wingdings");
   b.FontSize(15);
   b.Color(clrLimeGreen);
   b.Text(CharToStr(233));
   Sleep(10000);
}
//+------------------------------------------------------------------+
 
nicholishen:

It looks like you're trying to put your button in the upper right-hand corner. Here is an example script of how to do it. You'll also want to add a move function so the button moves when you resize the chart window.


Why?

Claudio's code includes

      ObjectSetInteger(chart,nometasto,OBJPROP_CORNER,CORNER_RIGHT_UPPER);

so it will always be in the position related to the top right corner when the chart button is re-sized. It is just a matter of including XSIZE in XDISTANCE.

 
Keith Watford:

Why?

Claudio's code includes

so it will always be in the position related to the top right corner when the chart button is re-sized. It is just a matter of including XSIZE in XDISTANCE.


Oh.. right on. I didn't realize that corner also applied to buttons. I just realized I've been using the wrong class... 

#include <ChartObjects\ChartObjectsTxtControls.mqh>
void OnStart()
{
//---
   CChartObjectButton b;
   b.Create(0,"Button",0,0,0,50,50);
   b.Corner(CORNER_RIGHT_UPPER);
   b.X_Distance(50);
   b.Font("Wingdings");
   b.FontSize(15);
   b.Color(clrLimeGreen);
   b.Description(CharToStr(233));
   Sleep(10000);
}
//+------------------------------------------------------------------+
Reason: