Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

debugging components

Status
Not open for further replies.

hennep

Programmer
Dec 10, 2000
429
0
16
I am searching for a way to debug a component without adding it to the component palette every time I want to test it.

Is there a way to add the component source to a (test)project ?

 
Not many ideas so far.

Another option would be a class, but I do not know if I can make a class generating events.

Is this possible ?
 
I have the same problem debugging components, but what I do is first check evgery function in a program, and then copy to the component

a class generating events?
explain more
 
> a class generating events?
> explain more

In vb, a class can raise an event. You can write an event handler that handles this event.
I wouldn't know how to do this in cbuilder.

What I am looking for is the alternative for "WithEvents".
 
Yep,

But I don't know if it can be done. Do you know if a class can fire events ?
 
I don't know what class can do that, but I know that every object have a property with the same name that the event, like this:

a button has the event OnClick, (you can active this function calling the Click() function)
and this button has the property Click

so for example if you has something like this
if (variable==5)
{
Timer1->OnTimer = Button1->Click;
}
Note that this is not a call it to a function, you just call the event when yo need it


Is your question answered? or I should explain more

-------LASTCYBORG------
 
if you are making a new class from existing components
wouldnt the new class inherit the events from the
original component(s). I wouldnt think you would have to create new events. just use the existing events already
in place for each object. I ain't done much on this level
but thats the way I think it is intended to work.

tomcruz.net
 
hi Tom

I dont make a class based on a component. I was just looking for a way to test my code.
Working with component works well as long as you do not want to change them. When you are working on a new component you have to add the new component to the toolbar before you can test it (or am I wrong ?).
My idea was to create a class instead of a component, to make it easier to test.
The problem with this approach is: I don't know how to fire an event from the classes code.

Hennie
 
I know I'm going to learn something from this one.
thanks in advance.

A component is a class already, right or wrong.
and since a class is just include files and such
you can do this in code or make a proper "component".

what events are you "firing" That are not inherited from
the base classes.

I'm still on the upward part of the learning curve about
templates and classes and inheritance.

tomcruz.net
 
I cannot tell whether a component is a class or not.
It has some things in common with a class, properties and methods. When it is possible to use events then there is another similarity. Nobody aswered this yet.

The reason I am studying on this subject. I found the source of a delphi component to send faxes. It is written in pascal (which I HATE). I found out that you can compile pascal with cbuilder.
So I decided to write this component in C++
It didn't get much further than the idea of doing it. I collected some information on this topic, if you want to have a look:
 
thanx for the link. As usual I downloaded all the files and put them on my rather large "to read" list.

tomcruz.net
 
I found something to generate events simulating keystrokes
overthere explain something about generate mouse events



---LastCyborg---
 
Two suggestions that you probably already know, if they have anything helpful at all, sorry if not!

To set off events in your component, declare in the private section:

TNotifyEvent FOnMyEvent;

Then declare in the __published section under public as such:

public:
__published:
__property TNotifyEvent OnMyEvent = {read=FOnMyEvent, write=FOnMyEvent};

Now this will show up in the Events tab in the object inspector.

Second suggestion to debug components at runtime.
Click Run->Parameters menu. Browse for the location to BCB.exe for the host application. Click the Load Button. Now, a new BCB process is started, hit F9 to continue loading all the way until you have a new blank form. Open your Component code, breakpoint at the beginning or wherever you suspect a problem. Now click the component on the tab up above and drop it on the form. You should get a break.

Hope that helps,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top