Bug? B4A v5.00 Block Commenting Works Differently ... ?


Active Member
Licensed User
It seems to me that block commenting works differently in v5.00 (both release and BETA) than it did in previous versions. Previously, I'm sure that I was able to take an entire block of code, including existing comments, and with the block command, add another layer of comment apostrophes in the first character position of each line, keeping the existing comment structure intact. Now, when I block comment, it first takes out all the existing comment apostrophes, making all lines "code," instead of just adding apostrophes in the first column. In other words the new version acts on comment apostrophes that occur anywhere, whereas before I think it acted only on apostrophes that existed in the first column.

I like the previous way it worked much better. The new way can easily lead to coding errors.


Licensed User
I'm not sure if that is the best way to do it?

Imagine you have a sub like this:
'This sub will create activity stuff
Sub CreateActivityStuff
  'Generate Toolbar
  'Generate Drawer
End Sub
Doing a block comment on this small sub:
- If the first line selected is the comment line above the sub then:
The first time all comments apostrophes will be removed and then it becomes an irreversible operation as all lines will either be comments or non-comments.​
- If the first line selected is the Sub line then:
It works pretty normally, i.e. it adds another apostrophe to the comment line essentially double commenting it, so it is a reversible operation​


Licensed User
I prefer the two button mode.
We know exactly what it does, one does commenting and the other uncommenting.
With the new mode we need to look first at the top lines of the block to change and choose the correct line to get the result we want.


Active Member
Licensed User
It toggles the comment state based on the state of the first line. If the first line is commented then all lines will be uncommented and vice versa.
Ah I see. OK, I can live with that. I can't believe I didn't figure that out myself! Am I wrong that this is different than pre-5.0 though? (Actually, from the above discussion, I guess it was 2-button before ... and single now). I think I prefer 2-button as well - unless the toggling worked just on the first column, in which case 1 button would be fine.


Well-Known Member
Licensed User
I agree, I prefer the old method as well.

Even better, however, would be some kind of block comments, for example:



Licensed User
The old method is better for me.


Well-Known Member
Licensed User
I noticed this behaviour in the Beta but realised what was happening and thought it was by design. I soon got used to selecting a blank line above any existing comments when wanting to block comment sections out. But I admit that you do need to exercise far more care than was needed with the old system. Personally I too prefer the old way.