Is it possible to output text on multiple lines in an OBJ_TEXT object? - page 6

 
Реter Konow:
You can read data from a resource using ResourceReadImage, but to do it you have to write it there using ResourceCreate. The ResourceCreate function accepts only an array of uint data, so if we need to write an array of another data type, we have to use union. Declare several arrays of different types in it. After that, we can store any data in the resource, including strings. To convert the string to char type use StringToCharArray and vice versa use CharArrayToString. So, it's not about the kanvas at all, but about the resource into which you can write any type of data with the help of unions.

Thank you for responding. That's exactly the mystery of the century for me. If you don't mind, more details about it.

The resource is created using ResourceCreate from uint data, but reading the resource has no results. And if you read the following opinions, you'll understand why I gave up, but you've given me hope.

 
Alexey Viktorov:

Thank you for responding. That's exactly the mystery of the century for me. If you don't mind, more details about it.

The resource is created using ResourceCreate from uint data, but reading the resource didn't work. And if you read the following opinions, you'll understand why I gave up, but you've given me hope.

That's not what Peter says :). He's on his own wavelength. He has outlined a scheme of how data can be exchanged between EAs via resources.

It has nothing to do with your task of recognising the Canvas inscription...

 
Andrey Barinov:

That's not what Peter says :). He's on his own wavelength. He outlined a scheme of how data can be exchanged between EAs via resources.

It has nothing to do with your task of recognising the caption from Kanvas...

I'm not ruling out the fact that I didn't quite phrase the question correctly.

If I create a resource, it is saved or I can force save it. And then read it. Read exactly the resource, as stated in the initial question.

Forum on trading, automated trading systems and strategy testing

Is it possible to output the text in multiple lines in OBJ_TEXT object?

Alexey Viktorov, 2019.08.05 09:30

New question: Can I read text from a resource in a canvas?

For example these lines, or any of them.

Purpose: The kanvas has a line, which contains a date. This is the date we want to read.

Or use one of the old tried and tested methods, GV, file, graphic or something else.


 
Alexey Viktorov:

I'm not ruling out the fact that I didn't phrase the question quite right.

If I create a resource, it is saved or it can be saved forcibly. And then read it. To read exactly the resource, as it was said in the initial question.


Well, here it is:

 
Andrey Barinov:

Well, there you go:


Andrei, but it did not go unnoticed by me

Forum on Trading, Automated Trading Systems and Strategy Testing

Is it possible to output the text in OBJ_TEXT object in several lines?

Alexey Viktorov, 2019.08.06 13:19

I have found it, but nothing works. I tried to convert array to string, but array types don't match. I don't know how to make it work. Maybe I'm doing something wrong, but no new ideas yet.


And then you offered nothing further.
 
Alexey Viktorov:

Thank you for responding. That's exactly the mystery of the century for me. If you wouldn't mind going into more detail about it.

The resource is created using ResourceCreate from uint data, but reading the resource has failed. And if you read the following opinions, you'll understand why I gave up, but you gave me hope.

OK, I'll try to go into more detail.

1. Declare the union.

2. Inside the union, you declare several arrays of different types.

For example:

//--------------------------------------------------------------------
union SEND{uchar char_Send[32000]; uint uint_Send[8000];};
union READ{uchar char_Read[32000]; uint uint_Read[8000];};
//--------------------------------------------------------------------


3. To write a string we need the char_Send array.

4. To read a string, we need an array char_Read.

5. Suppose we have a string "aalksdjghalkfhaerlkvhelvkjhalekhavk" and we want to write it to a resource. We do this:

int q = StringToCharArray("aalksdjghalkfhaerlkvkhelvkjhalekhavk",send.Char_Send);

After that, our string is in the Char_Send array.

6. For the string to be in the resource, we have to save the uint_Send array in ResourceCreate();

ResourceCreate("::Имя_ресурса",send.uint_Send,8000,1,0,0,0,COLOR_FORMAT_XRGB_NOALPHA);

7. It is important to understand that by writing the string in Char_Send, we have converted it to char type, and the string will automatically appear in the uint type. This is the essence of unions. If you write a string to Char_Send, it will already be in Uint_Send. You just save it with ResourceCreate();

8. To extract a string from a resource, use ResourceReadImage(); Specify the name of the resource and pass a uint_Read array to it.

ResourceReadImage("::Имя_ресурса",read.uint_Read,width,height);

9. After that, the string presented in uint_Read will already be in the char_Read array (without overwriting it), and you can extract it from char_Read using CharArrayToString().


Phew, I think that's it...)

 
Реter Konow:

OK, I'll try to be more specific.


Phew, I think that's it...)

Thanks Peter, it all worked out. It's just worth noting that if you use COLOR_FORMAT_XRGB_NOALPHA when creating a resource, the picture is not the same, to put it mildly. If we use COLOR_FORMAT_ARGB_NORMALIZE, the image is nice, but contains multiple symbols. I should probably experiment with the codepage. Maybe it will work...

 
Alexey Viktorov:

Thanks Peter, it all worked out. It's just worth noting that if you use COLOR_FORMAT_XRGB_NOALPHA when creating a resource, the picture is not the same, to put it mildly. If we use COLOR_FORMAT_ARGB_NORMALIZE, the image is nice, but contains multiple symbols. I should probably experiment with the codepage. Maybe it will work...

If the resource is supposed to store an image, there are three options for colour processing - COLOR_FORMAT_XRGB_NOALPHA, COLOR_FORMAT_ARGB_NORMALIZE, COLOR_FORMAT_ARGB_ROW. But if the resource is to store data, the COLOR_FORMAT_XRGB_NOALPHA option should be used, because colour processing is inappropriate.
 
Реter Konow:
If the resource is supposed to store an image, there are three options for colour processing - COLOR_FORMAT_XRGB_NOALPHA, COLOR_FORMAT_ARGB_NORMALIZE, COLOR_FORMAT_ARGB_RAW. But if the resource is to store data, the COLOR_FORMAT_XRGB_NOALPHA option should be used, because colour processing is not appropriate.

Got it, thanks. It turns out that we have to make two different resources for picture and data transfer.

 
Alexey Viktorov:

I see, thank you. It turns out that you have to make two different resources for the picture and the data transfer.

Of course.
Reason: