Button bug.

I am using TrueBASIC vers 5.41a on a PC with Windows XP Pro. I have been having problems with using the "CALL TC_PushBtn_Create" in a program.

First, the button id number is not reported in the event check correctly. My program has eight buttons, to which I have assigned IDs 1 thru 8, but when I did the event check, "CALL TC_Event," it would not work. In debugging it I found the problem. The button IDs reported by "CALL TC_Event" did not match the IDs I had assigned to the buttons in "CALL TC_PushBtn_Create." When I click the buttons that I assigned as 1 thru 8, "CALL TC_Event" reports the button IDs as 103 thru 110.?!

I corrected for this in the program, but when I bind the program, the button IDs change again to different IDs! I know they have changed in the bound program, because the buttons do the wrong things, or nothing at all, indicating buttons ID changes.

What good is assigning button IDs if I still have to guess at which button is being pressed?

Before anyone asks, yes, I can replicate it. In fact it replicates every single time I try it. I can email the program code if it helps to diagnose the problem. The program is about 20 pages long.

How do I fix this?

Has anyone else reported this problem?

Thanks for any help.

Comments

Hi Shawn, OK you missed the

Hi Shawn,

OK you missed the point about object IDs in TrueCtrl.
You do NOT assign numeric values to any object ID. You assign a numeric variable, e.g button1, button2, button3 etc., or you can use an array, e.g. button(1), button(2), button(3) etc.

In the TC_event loop you must use something like:

IF event$="CONTROL DESELECTED" then
IF x2=button1 then ! button1 pressed
IF x2=button2 then ! button2 pressed
IF x2=button3 then ! button3 pressed
etc

You NEVER need to know the absolute numeric values of the object ID variables. If you make modifications to your program or you add other objects, then all of the numeric values of the IDs will change.

Big John

Thank you John

Thanks John,
You are obviously right, I missed the point completely. Perhaps in my defense, the manual could be a bit clearer, but I really do appreciate the prompt and accurate solution to my problem.
Thanks again, Shawn

Suggestion: Could you make future manuals with spiral, lay-flat bindings? My poor manual is cracked and broken from being forced flat too many times. :(

Manuals

Hi Shawn,

It is not within my power to decide how manuals are presented, although I have to agree that lay-flat bindings are much better. For a time TB issued manuals in ring binders with hard covers, probably the best way to present manuals, but I don't know what the current method is.

I also agree with your comment about the manual not making the point clear about TrueCtrl object IDs. It is natural to assume that the IDs have a value, so it seems to me crucial that the manual should say and give examples of the way to use object IDs and why you never need to know the value. At first sight it does seem a bit screwball, but when you have used IDs a few times it becomes more obvious.

Big John