Download MetaTrader 5

Warning: implicit enum conversion

To add comments, please log in or register
Do you want to know about the MQL5.community development? Have a look at the Wall!
Patrick Bouche
195
Patrick Bouche 2010.08.29 04:03 

Hi there,

Using : https://www.mql5.com/en/articles/62 to create scripts in order to write and read objects&properties for a panel.

I had no problem for creating the write script (only a little change: FileWriteInteger from article need to replace by FileWriteLong)

However when reading the file to create the objects, I get the warning : implicit enum conversion, here is the lign:

ENUM_OBJECT obj_type=FileReadInteger(handle,4);

Follows the lign:

ObjectCreate(0, obj_name, obj_type, 0, 0, 0); 

 

I have tried to change FileReadInteger to FileReadLong  or even  ENUM_OBJECT to long but no success.

Any ideas or suggestions? Thx...

Maybe the author of the article could do the change/updates to his article. 

Creating Active Control Panels in MQL5 for Trading
  • 2010.05.25
  • Евгений
  • www.mql5.com
The article covers the problem of development of active control panels in MQL5. Interface elements are managed by the event handling mechanism. Besides, the option of a flexible setup of control elements properties is available. The active control panel allows working with positions, as well setting, modifying and deleting market and pending orders.
Patrick Bouche
195
Patrick Bouche 2010.08.30 02:59  
bouchepat:

Hi there,

Using : https://www.mql5.com/en/articles/62 to create scripts in order to write and read objects&properties for a panel.

I had no problem for creating the write script (only a little change: FileWriteInteger from article need to replace by FileWriteLong)

However when reading the file to create the objects, I get the warning : implicit enum conversion, here is the lign:

ENUM_OBJECT obj_type=FileReadInteger(handle,4);

Follows the lign:

ObjectCreate(0, obj_name, obj_type, 0, 0, 0); 

 

I have tried to change FileReadInteger to FileReadLong  or even  ENUM_OBJECT to long but no success.

Any ideas or suggestions? Thx...

Maybe the author of the article could do the change/updates to his article. 

Well regardless of the warning message:

implicit enum conversion && possible loss of data due to type conversion

the script is working fine... but instead of FileReadInteger replace to FileReadLong.... Answer myself, thought it might help someone else. 

 

Max Payne
411
Max Payne 2010.09.09 22:34  
bouchepat:

...

ENUM_OBJECT obj_type=FileReadInteger(handle,4);

... I get the warning : implicit enum conversion

Well, an int, as returned by "FileReadInteger", can, in general, have more values than the enumeration type, so the compiler is warning you that the implicit conversion, as performed by the compiler, may not succeed. However, you can take the responsibility for the conversion by inserting an explicit cast!

ENUM_OBJECT obj_type = (ENUM_OBJECT)FileReadInteger(handle,4);

Cheers!

To add comments, please log in or register