I tried to make a table with labels in a monospace font as suggested here - it's not a pleasant sight for the eye. Especially fractional numbers are smeared horizontally in such a way that it's very hard to see. So we are left with the option of labels in a regular font, with a separate label for each cell. That would involve quite a few objects, as I've written before.
Jartmailru, do you know if it's realistic to create an output window directly in the EA code, without using a DLL? All WinApi functions are available. The only snag may be only when passing a structure containing both variables and pointers at the same time.
It's nice, but you don't have tables with a lot of long numbers in a row, so it's pretty easy to read.
Maybe, I don't know, I've never set myself such a task. Having the terminal as a fairly good tool for displaying various kinds of graphical information in the form of graphs and charts, to build and analyse a large amount of textual information in it? - Why when you have Excel for that ... Although of course this is my humble opinion :)
jartmailru: On the other hand, I wonder if you haven't already encountered that the first 30% of entries are usually missing from the log, and that entries are selectively lost afterwards.
The logs have all the lines, it is the terminal that selectively displays them. If you open the files themselves, they are all there.
// Can you make a DLL for Unicode? I will be sincerely grateful.
Here you go. Added functions LogW, SelectW, but did not test - any problems please contact. If you will make binder for 5th, please send it to me :-). .
Meat:
Jartmailru, do you know if it's realistic to create an output window directly in the EA code without using a DLL? All WinApi functions are available. The only hitch may be only when passing a structure containing both variables and pointers.
If you have done something twisted, maybe it's possible. I do not twist :-). A window next to an MT in C++ requires a separate interface thread. If it's a single window, it's trivial. . By the way... it's not a fact that tabs... ...you'll be able to align the contents of the columns to the right degree. .
PapaYozh: The logs have all the lines, it's the terminal that shows them selectively. If you open the files themselves, they are all there.
I don't mind :-). But: I have everything displayed + I have done a graph- log (the point from the graph is searched in the log - the right place is shown). .
Well, I've made a tab for multi-spaced fonts! :) Yay! :) Of course, I had to make a lot of trouble with WinAPI functions, but it was worth it. It's useful not only for Comment, but for Label too. The idea is that we get the size of any string in any font in pixels. And then you can tabulate them as you like, either left, right, or centre. For Comment, tabulation is naturally done with spaces, so the result is not perfect, the error is within 1-2 pixels, but it's nothing in principle. For labels, everything is much simpler.
Here's an example showing tabs in Comment. Tahoma,8 is specified here, as comments are output in that font.
#import "Gdi32.dll"int CreateFontA(int nHeight,int nWidth,int nEscapement,int nOrientation,int fnWeight,int fdwItalic,int fdwUnderline,
int fdwStrikeOut,int fdwCharSet,int fdwOutputPrecision,int fdwClipPrecision,int fdwQuality,
int fdwPitchAndFamily,string lpszFace);
int SelectObject(int hdc,int hgdiobj);
bool DeleteObject(int hObject);
int GetDeviceCaps(int hdc,int nIndex);
bool GetTextExtentPoint32A(int hdc,string lpString,int cbString,int lpSize[]);
#import "user32.dll"int GetDC(int hWnd);
int ReleaseDC(int hWnd,int hDC);
//+------------------------------------------------------------------+int start()
{
#define DEFAULT_CHARSET 1#define OUT_DEFAULT_PRECIS 0#define CLIP_DEFAULT_PRECIS 0#define DEFAULT_QUALITY 0#define DEFAULT_PITCH 0#define FF_MODERN 48int hWnd=WindowHandle(Symbol(),Period());
int DC=GetDC(hWnd);
int dpi=GetDeviceCaps(DC,88); //88=LOGPIXELSXstring Font="Tahoma";
int fontsize=8;
int fontheight=MathRound(fontsize*dpi/72.0);
int hFont=CreateFontA(fontheight,0,0,0,0,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_MODERN,Font);
SelectObject(DC,hFont);
string StringArray[]={"Один","Два","Три","Четыре","Пять","Шесть","Семь","Восемь","Девять","Десять","Одиннадцать","Двенадцать"};
int arraysize=ArraySize(StringArray);
int tabpixels=100; // размер табуляции в пикселяхint size[2];
GetTextExtentPoint32A(DC," ",1,size); // получаем размер пробелаint spacesize=size[0];
if (spacesize==0) { Alert("spacesize=0"); return(0); }
string text="\n";
int rowsize=0;
int alignmode=0; // 0- по левому краю, 1- по правому краюfor (int i=0; i<arraysize; i++)
{
int column=i%4;
string str=StringArray[i];
GetTextExtentPoint32A(DC,str,StringLen(str),size); // получаем размер строкиint spacecount=MathRound((tabpixels*(column+1)-size[0]-rowsize)*1.0/spacesize);
for (int s=0; s<spacecount; s++)
if (alignmode==0)
str=str+" ";
else
str=" "+str;
rowsize+=size[0]+spacesize*spacecount;
text=text+str;
if (column==3 || i==arraysize-1)
{
text=text+"\n";
rowsize=0;
if (i<arraysize-1) continue;
if (alignmode==1) break;
alignmode++;
text=text+"\n\n";
i=-1;
}
}
Comment(text);
ReleaseDC(hWnd,DC);
DeleteObject(hFont);
return(0);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I tried to make a table with labels in a monospace font as suggested here - it's not a pleasant sight for the eye. Especially fractional numbers are smeared horizontally in such a way that it's very hard to see. So we are left with the option of labels in a regular font, with a separate label for each cell. That would involve quite a few objects, as I've written before.
Jartmailru, do you know if it's realistic to create an output window directly in the EA code, without using a DLL? All WinApi functions are available. The only snag may be only when passing a structure containing both variables and pointers at the same time.
labels in the mono-wide
the labels in the mono-chine.
In a mono-chine, you mean?
It's nice, but you don't have tables with a lot of long numbers in a row, so it's pretty easy to read.
In a mono-wide you mean?
It's nice, but you don't have tables with a lot of long numbers in a row, so it's pretty easy to read.
On the other hand, I wonder if you haven't already encountered
that the first 30% of entries are usually missing from the log, and that entries are selectively lost afterwards.
// Can you make a DLL for Unicode? I will be sincerely grateful.
If you will make binder for 5th, please send it to me :-).
.
Jartmailru, do you know if it's realistic to create an output window directly in the EA code without using a DLL? All WinApi functions are available. The only hitch may be only when passing a structure containing both variables and pointers.
A window next to an MT in C++ requires a separate interface thread.
If it's a single window, it's trivial.
.
By the way... it's not a fact that tabs... ...you'll be able to align
the contents of the columns to the right degree.
.
The logs have all the lines, it's the terminal that shows them selectively. If you open the files themselves, they are all there.
log (the point from the graph is searched in the log - the right place is shown).
.
Well, I've made a tab for multi-spaced fonts! :) Yay! :) Of course, I had to make a lot of trouble with WinAPI functions, but it was worth it. It's useful not only for Comment, but for Label too. The idea is that we get the size of any string in any font in pixels. And then you can tabulate them as you like, either left, right, or centre. For Comment, tabulation is naturally done with spaces, so the result is not perfect, the error is within 1-2 pixels, but it's nothing in principle. For labels, everything is much simpler.
Here's an example showing tabs in Comment. Tahoma,8 is specified here, as comments are output in that font.
Here's an example showing tabbing in Comment. The font set here is Tahoma,8, as comments are output in this font.
+ remade output of any text, not just an array of lines
+ made it as a separate function CommentTab
+ added an array of TabStop values and a default Tab size (as in the GDI function)
Example of text and result