Board index » cppbuilder » Can't find click event

Can't find click event


2007-03-08 09:47:16 AM
cppbuilder80
I am using BCB 6 and run into a strange problem, hoping some one can give me
some suggestions on how to proceed to find the cause or correct the problem.
I started making some minor mods to code that was working fine and it
suddenly started giving ACCESS and ABSTRACT (what ever that is) exceptions
at places that just do not make sense. I have several edit label boxes that
when I execute the Clear() method gives me an exception. Putting a
breakpoint on the line control->Clear(); then stepping over gives an
exception. I have a radio button that when I click it gives me an Abstract
error exception, another gives and Access exception.
Now I am fairly sure that the code has not changed since it was working fine
(I took all the changes out). But of course I'm thinking what did I put in
that is overwriting the control pointers, etc. But the strange thing is that
if I go to the OBJECT INSPECTOR in the IDE and double click on the OnClick
event name (which is correct) I get a message saying it can't find the event
method. I have several other controls that do the same thing.
The code builds fine and I can do a search on the event name and find the
event method definition and declaration so they are actually in the code. I
am about ready to reinstalll the compiler thinking something got clobbered
in it but that does not explain the strange IDE messages.
Any suggestions or help is greatly appreciated.
Bill Riley
 
 

Re:Can't find click event

Quote
I started making some minor mods to code that was working fine and it
suddenly started giving ACCESS and ABSTRACT (what ever that is) exceptions
at places that just do not make sense.
This usually means that memory is getting overwritten somehow in your code.
Try turning on CodeGuard to see if it can help you find this type of error.
If your app is multithreaded you might be doing some operations in a worker
thread that are not allowed.
Quote
But the strange thing is that if I go to the OBJECT INSPECTOR in the IDE
and double click on the OnClick event name (which is correct) I get a
message saying it can't find the event method.
This has happened to me several times and it has always been a problem
caused by me, and not the IDE or compiler. Though, a few times I remember I
needed to restructure my code slightly to make the IDE capable of finding
the handler. It could be caused by certain macro enclosures, argument lists
that are no longer in sync, or any other number of code peculiarities. What
you can do to track this down is keep moving your click handler method up in
your CPP file and double click in the object inspector for the IDE to take
you to it. When it stops complaining then you'll know that something in the
code after the handler is what the IDE is having a problem with.
- Clayton
 

Re:Can't find click event

Clayton,
Thanks for the response. I understand that I am probably clobbering memory
somewhere but the IDE "bug" of not finding the event definition for several
controls and another possible bug in the IDE (see my previous posting
11/27/06 to which no one responded) threw me off making me think it was not
my code. Of course I never think it is my fault.
But it appears you are correct, it appears that the IDE cannot find some
event code because I have moved it from the original form code file setup by
the IDE.
But that now leaves me with trying to find my bug and I hope you can give me
some further information.
Note that I am a single programmer programming in my spare time without any
development department to back me up or help nor have the buget to get
better tools. I use only the personal edition of BCB6 and it appears to add
many limitations that I am unaware of .
1. The help files specifically indicate that I can set a data breakpoint to
break whenever a write is done to the location. But this feature does not
show up anywhere where the help file says to set it. Am I missing something
or does the personal edition not include this? I figure I can use it to see
if some control pointers are getting overwritten.
2. You mention CodeGuard. I cannot find this anywhere in the help files. A
search of this newsgroup leads me to believe this is a Borland product that
may be included in the IDE but I have not been able to track it down. A
search on the Borland home page gives me no hits. A search on the Borland
community page, which appears now to be Code Gear does give me anything
enlightening. Is this a separate product that must be purchased or available
in the IDE?
Any further suggestions or information greatly appreciated.
Bill Riley
 

{smallsort}

Re:Can't find click event

Quote
Of course I never think it is my fault.
I think that's normal. I struggle all the time with changing my approach to
start by believing it could be something I did wrong.
Quote
1. The help files specifically indicate that I can set a data breakpoint
to break whenever a write is done to the location.
Can you point me to the location in the help that mentions this? It's not
clear to me what this might be referring to (other than possibly CodeGuard).
Quote
2. You mention CodeGuard.
I did a quick search using Google Groups (search string "bcb6 personal
codeguard") and found several posts which mention that CodeGuard is not in
the personal version. This means you'll need to find a product somewhere to
fill this need for you. AQTime by Automated QA is pretty good but might be
out of your budget range. There is a fully functional 15 day trial for the
product that you might use to track down this one problem you are having.
You might also try MemProof. There are other tools available but I've never
had a need to use them since CodeGuard works for me 95% of the time.
If your project isn't too large you can zip up the source and post to the
attachments group. I can take a look at it and see if I can find anything
obvious. However, I am a tad busy right now so I can't promise anything.
- Clayton
 

Re:Can't find click event

Clayton,
Help | C++Builder Help ->Index; type in "debugging" and select
debugging|breakpoints then select "Setting Breakpoints" from the dialog.
This specifically discusses the data breakpoint and three methods to
access/set the data breakpoint. None of the methods appear to be available
to me. They talk about the breakpoint view and watch view, not sure what
that means. I assume it means essentially working in the watch list and
breakpoint list. But none of the options discussed in the first two points
(breakpoint and watch view) exist in my IDE. The third option selecting Run
| Add Breakpoint | Data Breakpoint does not exist either. I only have Run |
Add Breakpoint | Source or Address breakpoint, no Datat choice. This option
is suppose to bring up a Data Breakpoint dialog and there is further help on
this by indexing on Breakpoint.
Appreciate the offer to look at my code but I think it is too big and
unwieldy to quickly look over. I am going back to my last known version and
try to add in the changes somewhat piecemeal to see if I can pin down the
problem. I might try to use this as a selling point to my boss to upgrade my
compiler.
Thanks again, Bill Riley.
 

Re:Can't find click event

Quote
Help | C++Builder Help ->Index; type in "debugging" and select
debugging|breakpoints then select "Setting Breakpoints" from the dialog.
Interesting. I wasn't aware the de{*word*81} was capable of this. I do have
these options in my IDE. I can see how they might be useful.
Quote
I might try to use this as a selling point to my boss to upgrade my
compiler.
You might need to do that anyhow. Consider this excerpt from the BCB6
Personal Edition License:
You may not use the Product or any Work for any commercial, business,
governmental or institutional purpose of any kind.
Some people have interpreted this as meaning you can't use BCB6 PE in the
office-place. Though, I believe it simply means you can't sell programs
that you make with it.
I doubt Borland is going to "come after you" but if your company is selling
your product you might want it to be legitimate. Upgrading to BCB6 Pro or
Standard might be best for you. Though, I'm not sure where you can get your
hands on a copy of one. You might be able to upgrade to Turbo C++ 2006
(www.turboexplorer.com/) though I'd try the free version first to
make sure it will work for you before purchasing it. Additionally you can
go for the full product BDS2006 (or soon BDS2007) but that might be out of
the budget range too.
Good luck,
- Clayton
 

Re:Can't find click event

Thanks for the info. My development is used only within the company. Read
the license and it seems to say its OK to distribute as long as it is not
comercial.
But just to update on the original problem. I restructured the entire
project as a new project, not copying from the previous version. Now the
program works fine. My guess is that in changing how forms were created, I
had just let the IDE do its default auto create on all my forms not
realizing that it was possible to do it any other way. So any way I ended up
restructuring how the forms were created by hand editing the code. It seems
like if you move things around without directly telling the IDE it gets
confused; anyway thats my take for now unless you have any further insight.
Thanks for the help.
Bill Riley