Bug? One line case: won't autocomplete

NeoTechni

Well-Known Member
Licensed User
Longtime User
B4X:
Select case
case: testcode
end select

For code where you just want the case: on one line, the autocomplete won't show for anything after the :
 

Cableguy

Expert
Licensed User
Longtime User
The case statement does not expect a ":" after it.
If you look at the many examples of general use of the case statement, you'll see the you can use...

Select a
Case "abc"
Code here
Case 123
Code here
Case else
End select
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I prefer to be able to use "case:" when the code can fit on one line (to look neater), which is supported by the parser
 

Cableguy

Expert
Licensed User
Longtime User
The purpose of "case" is to be able to go through more interactions than an "if".
If all you need is to check a variable for a specific value, then use an "IF"...
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
The purpose of "case" is to be able to go through more interactions than an "if".

Which is what I'm using it for. I never said I was just checking a variable for a specific value. The code I posted was merely example/dummy code to show the bug at work.

Actual code:

B4X:
Sub GetListStyleFont(Style As Int) As Typeface
   If Style=-1 Then Style = CurrentStyle
   Select Case Style
     Case STYLE_StarWars:      Return Typeface.DEFAULT
     Case STYLE_Alien:        Return Aliens.LCDfont
     Case STYLE_RESIDENTEVIL:   Return Typeface.DEFAULT         
   End Select
   Return GetStyleFont(Style)
End Sub
Sub GetStyleFont(Style As Int) As Typeface
   If Style=-1 Then Style = CurrentStyle
   Select Case Style
     Case STYLE_Moon:            Return StarshipFont'1
     Case STYLE_RoboCop, STYLE_Alien:    Return RoboCop.RoboFont'2
     Case STYLE_EventHorizon:        Return Typeface.DEFAULT_BOLD'3
     Case STYLE_BSG:             Return Legacy.DRD_Font'4
     Case STYLE_StarWars:         Return Legacy.SWFont'5
     Case STYLE_Prometheus:         Return Prometheus.TheFont
     Case STYLE_Elysium:           Return Elysium.NewFont
     Case STYLE_STARGATE:          Return StarshipFont
     Case STYLE_STroopers:         Return StarshipTroopers.Font
     Case STYLE_RESIDENTEVIL:       Return Prometheus.TheFont
     Case STYLE_Watchmen:         Return ChicagoFont
     Case STYLE_Terminator:         Return Terminator.BigFont
     Case STYLE_Oblivion:         Return Aliens.ArielBold
   End Select
   Return Typeface.DEFAULT
End Sub
 

Cableguy

Expert
Licensed User
Longtime User
Well, your dummy code was really... dummy, and it didn't reflect exactly what your bug was about.
Now, withe the rest of the "real code" I can understand what your bug report is about and furthermore state that I learned something from your example
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
and it didn't reflect exactly what your bug was about

Actually it does. "For code where you just want the case: on one line, the autocomplete won't show for anything after the :"

Had you tried typing the code yourself, it'd show you the bug. Hence the example code.
 
Top