Addendum to button bug

This is the problem code (sections of much longer program) associated with my previous bug report. This is from TrueBASIC Silver vers 5.41a on a PC with Windows XP Pro.

As you can see, the buttons ID numbers for the "CALL TC_PushBtn_Create" do not match the ID numbers for the "CALL TC_Event." If I bind the program, the ID numbers reported by "CALL TC_Event" change again.

Yes, it can be replicated, in fact it replicates every single time.

What is causing this?

What can be done to fix this?

LET MOVEWINDOW=3
CALL TC_Win_Create (MOVEWINDOW, "Title Size", .75, .95, .1, .4) ! COORDS = XL, XR, YB, YT
CALL TC_Show (MOVEWINDOW)
CALL TC_Win_Switch (MOVEWINDOW)
CALL TC_Win_SetTitle (MOVEWINDOW, "Movement")
SET WINDOW 0, 100, 360, 0

CALL TC_PushBtn_Create (1, "Forward", 30, 70, 10, 50)
CALL TC_PushBtn_Create (2, "Backward", 30, 70, 110, 150)
CALL TC_PushBtn_Create (3, "Turn Left", 5, 45, 60, 100)
CALL TC_PushBtn_Create (4, "Turn Right", 55, 95, 60, 100)
CALL TC_PushBtn_Create (5, "Help", 20, 80, 160, 200)
CALL TC_PushBtn_Create (6, "Save Game", 20, 80, 210, 250)
CALL TC_PushBtn_Create (7, "Open Game", 20, 80, 260, 300)
CALL TC_PushBtn_Create (8, "Print Map", 20, 80, 310, 350)

DO
CALL TC_Win_Switch (MOVEWINDOW)
CALL TC_Init
CALL TC_Event (3, EVENT$, 3, BLANK1, WHICHBUTTON)
IF EVENT$="CONTROL DESELECTED" THEN
IF WHICHBUTTON=103 THEN
SELECT CASE D
CASE 1
CALL FINDFRONT (PY-1,PX)
EXIT DO
CASE 2
CALL FINDFRONT (PY,PX+1)
EXIT DO
CASE 3
CALL FINDFRONT (PY+1,PX)
EXIT DO
CASE 4
CALL FINDFRONT (PY,PX-1)
EXIT DO
CASE ELSE
END SELECT
ELSEIF WHICHBUTTON=104 THEN
SELECT CASE D
CASE 1
CALL FINDFRONT (PY+1,PX)
EXIT DO
CASE 2
CALL FINDFRONT (PY,PX-1)
EXIT DO
CASE 3
CALL FINDFRONT (PY-1,PX)
EXIT DO
CASE 4
CALL FINDFRONT (PY,PX+1)
EXIT DO
CASE ELSE
END SELECT
ELSEIF WHICHBUTTON=105 THEN
IF D=1 THEN LET D=4 ELSE LET D=D-1
EXIT DO
ELSEIF WHICHBUTTON=106 THEN
IF D=4 THEN LET D=1 ELSE LET D=D+1
EXIT DO
ELSEIF WHICHBUTTON=109 THEN
CALL GETLEVEL
IF G$<>"" THEN
CALL FETCHMAP
IF LEVEL1 THEN
LET UP=1
CALL PERSON
ELSE IF LEVEL=MAX AND LEVEL<>1 THEN
LET UP=0
CALL PERSON
END IF
END IF
EXIT DO
ELSEIF WHICHBUTTON=110 THEN
CALL SHOWMAP
EXIT DO
ELSEIF WHICHBUTTON=108 THEN
CALL SAVEMAP
EXIT DO
ELSEIF WHICHBUTTON=107 THEN
CALL INSTRUCTIONS
EXIT DO
END IF
END IF
CALL TC_Cleanup
WINDOW #1
LOOP
CALL TC_Cleanup
WINDOW #1

Comments

Hi Shawn, Read my reply

Hi Shawn,

Read my reply under bug reports.

Basically you never assign numeric values to object ID's, you must only assign numeric variable names.

Big John