If I compile this program with the F5 key, then a wrong error message occurs.
Code: Select all
; Wrong error message
EnableExplicit
DataSection
Cards: ; each row is a card, -1 ist the end of the cards data
Data.w 825, 0, 0, 225, 0, 160, 20, 0, 200
Data.w 775, 0, 0, 250, 0, 175, 0, 50, 200
Data.w 700, 0, 0, 237, 0, 176, 0, 0, 0
Data.w 633, 0, 0, 0, 0, 0, 0, 188, 193
Data.w 965, 0, 0, 200, 35, 200, 0, 200, 130
Data.w 651, 0, 110, 250, 0, 168, 0, 1, 192
Data.w 600, 0, 0, 250, 0, 160, 40, 0, 150
Data.w 580, 0, 0, 250, 90, 230, 70, 200, 180
Data.w 600, 0, 0, 247, 0, 200, 0, 210, 200
Data.w -1
EndDataSection
#Window1 = 0
#Titel = "Wrong error message"
#h = 400
#w = 600
Global.w Number_of_cards
Define.i Window_Flags, Event
Procedure Try(Result.i, MessageText.s)
If Result = #False
MessageRequester("Error", MessageText, #PB_MessageRequester_Ok)
End
EndIf
EndProcedure
Procedure Count_Cards()
; each data row is one card
Protected.i i
Protected.w value
Number_of_cards = 0
Restore Cards
Read.w value
While value <> -1
Number_of_cards + 1
For i = 1 To 8 ; rest of data row
Read.w value
Next i
Read.w value ; new data row
Wend
ProcedureReturn
Window_Flags = #PB_Window_ScreenCentered | #PB_Window_TitleBar | #PB_Window_SystemMenu
Window_Flags | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Try(OpenWindow(#Window1, 0, 0, #w, #h, #Titel, Window_Flags), "Can not open window.")
Count_Cards()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
ForEver