Download MetaTrader 5
To add comments, please log in or register
How to buy a product in MetaTrader AppStore? Read the article!
Sya
56
Sya 2015.06.16 14:35 

At first, thanks for reading.

Is there a possibility to insert for instance tabs into the code by the "replace all" edit-window? 

Maybe the string "ObjectSetText" bei tab and "ObjectSetText"?

In other programming environments you can use "\t" or others for referencing. I tried several possibilities, including copying the tab into clipboard and pasting it into the replacement field. But nothing did work in the intended way, nor did I found something helpful in the net.

I use Metaeditor version 5.00 build 1150

Alain Verleyen
Moderator
28635
Alain Verleyen 2015.06.16 18:32  
Bad coding practice are not encouraged by MetaEditor
Sya
56
Sya 2015.06.19 11:21  

You think, it's bad coding practice? Do you esteem tabs as unwanted in code? Would you prefer to have blanks instead?

To me, it always has been great to use tabs for indents to have the code clearly arranged, no matter what language I was working with. But there is always space to learn, so I would be happy to hear, what you think about it.

whroeder1
13630
whroeder1 2015.06.19 14:02  
Sya: You think, it's bad coding practice? Do you esteem tabs as unwanted in code? Would you prefer to have blanks instead?
Yes it's bad. There is no definition of the size of a tab. If you place tabs in the code, you loose your spacing if you move to other programs:
// 4 6 7 9
//      |       |       |       < this line has three tabs with notepad set to 3
// |  |  |  < THIS LINE HAS SPACES
// 4 6 7 9

But this is what I see in notepad2

I use tabs in my editor while coding but convert them before saving.

Alain Verleyen
Moderator
28635
Alain Verleyen 2015.06.19 15:21  
Sya:

You think, it's bad coding practice? Do you esteem tabs as unwanted in code? Would you prefer to have blanks instead?

To me, it always has been great to use tabs for indents to have the code clearly arranged, no matter what language I was working with. But there is always space to learn, so I would be happy to hear, what you think about it.

As explained by WHRoeder, yes it's bad practice. I used tab key to indent but always with the option "Insert spaces" enabled.
Sya
56
Sya 2015.06.20 10:02  

Yes, I understand. Thank you for the detailed explanations. Of course, you have to follow a strict tab-size-management, when using them, especially, when changing to an upgrade of the editor.

As long as I am coding, to my exoerience, tabs save a lot of time. But I agree, when making a programm available to the public, it might be wiser to replace the tabs with spaces. I'll keep this in mind.

Alas, my inital problem persists, so I'll still have to use another editor for those parts I want to handle the described way. But better to know, there is no in-built solution, than stay on search for it.


Kind regards
and have a nice weekend

JD4
1101
JD4 2015.06.23 05:53  
WHRoeder:
Yes it's bad. There is no definition of the size of a tab. If you place tabs in the code, you loose your spacing if you move to other programs:

But this is what I see in notepad2

I use tabs in my editor while coding but convert them before saving.

There doesn't have to be a definition.  In the new program, the tabs will still always be the same as they were in the other one, just the viewing will be messed up.  It is not good or bad coding practice, it just is.
whroeder1
13630
whroeder1 2015.06.23 14:12  
JD4: just the viewing will be messed up.
That is why it is bad practice.
JD4
1101
JD4 2015.06.23 21:54  
WHRoeder:
JD4: just the viewing will be messed up.
That is why it is bad practice.

If the same person is the one viewing it and the only one working on their code and they can read it, THAT is why it is not bad practice.  If the person is one coder in a team working for a company, then yes, it could be considered bad coding.  However, there is a strong possibility in this case that all coders are using the same editing program, even if they were on different terminals, which would show all the tabs in the same way.  Which makes it as easy to read for one person as the next.  I have seen a similar issue on the Java programs I have seen coded before.  (For the record, I normally do not use tabs until it becomes necessary, but so far most of my code only has used 1 or 2 indent levels.)

Some people will do...

method call(){
  ...code goes here
}
 and some will do

method call()
{

  ... code goes here
}
/
To add comments, please log in or register