The B4A IDE will let you collapse subs to show only a single line. So code like this
can be displayed as this
This makes it much easier to work on modules that contain many lines of code.
It would be nice if there were a way to add some kind of flags so that blocks of code within a sub could be collapsed to a single line. For example, if code like this
could be collapsed to show something like this
It would be a big help in coding within some subs.
I have one sub that presently contains over 400 lines of code which I expect may reach well over twice that before it is complete. In this particular sub, there is a Select Case statement where each case contains many lines of code that, once tested, I do not really need to see when I am working on the rest of the program. It would make it much easier if I could collapse some sections to a single line while I am working on the program - would avoid having to do a lot of scrolling through code.
B4X:
...
End Sub
Sub ShowPlace
' This shows the player info about the current location
Dim x, y As Int
Dim ExitsInfo As String
Dim Exits(4) As String
x = Main.Player.PlayerX
y = Main.Player.PlayerY
Exits(0) = ""
...about 150 lines of code
End Sub
Sub DoCmd(Cmd As String)
...
B4X:
...
End Sub
Sub ShowPlace
Sub DoCmd(Cmd As String)
...
This makes it much easier to work on modules that contain many lines of code.
It would be nice if there were a way to add some kind of flags so that blocks of code within a sub could be collapsed to a single line. For example, if code like this
B4X:
Select Case Main.Player.PlayerLoc
Case 0 ' Player is on surface
If Main.Maps.Above(x, y).Visited Then
If Main.Rooms.Surface(Main.Maps.Above(x, y).RoomPtr).ShortDesc = "ditto" Then
Printit(Main.Rooms.Surface(Main.Maps.Above(x, y).RoomPtr).LongDesc, False)
Else
Printit(Main.Rooms.Surface(Main.Maps.Above(x, y).RoomPtr).ShortDesc, False)
End If
Else
...many more lines of code...
Case 1 ' Player is in tunnel
If Main.Maps.Tunnel.Visited Then
If Main.Rooms.Tunnel(Main.Maps.Tunnel.RoomPtr).ShortDesc = "ditto" Then
Printit(Main.Rooms.Tunnel(Main.Maps.Tunnel.RoomPtr).LongDesc, False)
Else
Printit(Main.Rooms.Tunnel(Main.Maps.Tunnel.RoomPtr).ShortDesc, False)
End If
Else
...more code...
B4X:
Select Case Main.Player.PlayerLoc
Case 0 ' Player is on surface
Case 1 ' Player is in tunnel
If Main.Maps.Tunnel.Visited Then
If Main.Rooms.Tunnel(Main.Maps.Tunnel.RoomPtr).ShortDesc = "ditto" Then
Printit(Main.Rooms.Tunnel(Main.Maps.Tunnel.RoomPtr).LongDesc, False)
...more code...
I have one sub that presently contains over 400 lines of code which I expect may reach well over twice that before it is complete. In this particular sub, there is a Select Case statement where each case contains many lines of code that, once tested, I do not really need to see when I am working on the rest of the program. It would make it much easier if I could collapse some sections to a single line while I am working on the program - would avoid having to do a lot of scrolling through code.