Board index » cppbuilder » Re: Component Editor problems

Re: Component Editor problems


2005-04-01 10:05:14 PM
cppbuilder2
You know what. I'm giving up on it... other programmers can just live
with my hundred some properties listed in a row. I am wasting to much
time trying to figure this out.
Shannon
 
 

Re:Re: Component Editor problems

Remy Lebeau (TeamB) wrote:
Quote
"SP" < XXXX@XXXXX.COM >wrote in message
news:424c747f$ XXXX@XXXXX.COM ...


>I believe I am having a design time / run time problem because
>when I place the component onto a form in an application and try
>to compile I get a bunch of linker unresolved external errors. The
>design time stuff seems to work but now I can't compile.


Design-time code is not allowed to be compiled into executables. Nor should
it be anyway, since it only benefits the IDE to begin with, not the compiled
executable. You need to move your design-time code into a separate package
than your component. Mark the component package as "Runtime only" in the
Project Option. Mark the editor package as "Designtime only" in the Project
Options, and add the component package to the Requires list. Then install
both packages into the IDE, with the component Runtime package being first
so the Designtime editor package can find it.


Gambit


ok it seems to work now. but I am having 1 annoying problem now... if
I open the property at design time and close it there seems to be a
problem freeing memory or it is freeing the wrong memory and I get an
access violoation when closing down borland builder. I am able to
create a program access the componet property and change the data now so
I am making some progress.
here is the code I use to open the form as showmodal.
TfrmGraphDialog* frmGraphDialog = new TfrmGraphDialog(0);
frmGraphDialog->ShowModal();
I found the following lines of code but I get a compiler error about
"could not find a match for _STL::auto_ptr..." where the ... is the
from declaration code.
std::auto_ptr<TfrmGraphEditor*>frmGraphEditor(new TfrmGraphEditor(0));
frmGraphDialog->ShowModal();
what could be going wrong?
Shannon
 

Re:Re: Component Editor problems

"SP" < XXXX@XXXXX.COM >wrote in message
Quote
here is the code I use to open the form as showmodal.
You are not freeing the form when it closes:
TfrmGraphDialog* frmGraphDialog = new TfrmGraphDialog(NULL);
try {
frmGraphDialog->ShowModal();
}
__finally {
delete frmGraphDialog; // <--
}
Quote
I found the following lines of code but I get a compiler error about
"could not find a match for _STL::auto_ptr..." where the ... is the
from declaration code.
Did you include the appropriate header file? Also, get rid of the asterik
in the declaration:
#include <memory>
std::auto_ptr<TfrmGraphEditor>frmGraphEditor(new
TfrmGraphEditor(NULL));
frmGraphDialog->ShowModal();
Gambit
 

{smallsort}

Re:Re: Component Editor problems

Remy Lebeau (TeamB) wrote:
Quote
"SP" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...


>here is the code I use to open the form as showmodal.


You are not freeing the form when it closes:

TfrmGraphDialog* frmGraphDialog = new TfrmGraphDialog(NULL);
try {
frmGraphDialog->ShowModal();
}
__finally {
delete frmGraphDialog; // <--
}


>I found the following lines of code but I get a compiler error about
>"could not find a match for _STL::auto_ptr..." where the ... is the
>from declaration code.


Did you include the appropriate header file? Also, get rid of the asterik
in the declaration:

#include <memory>

std::auto_ptr<TfrmGraphEditor>frmGraphEditor(new
TfrmGraphEditor(NULL));
frmGraphDialog->ShowModal();


Gambit


both methods worked well. I used the second method.
thanks Remy for all you help.
Shannon
 

Re:Re: Component Editor problems

another question for you.
How do you store property changes using the propertyeditor.
I've seen code resembleing this
((Tmyclass*)(component))->myproperty = whatIwant;
but TPropertyEditor doesn't know what component is
I've tried adding a dynamic_cast like
myclassptr = dynamic_cast<Tmyclass*>(component);
but again TPropertyEditor doesn't know what component is.
I want to programmically set the properties but for some reason I can't
find any example code that does that and I don't understand how it is
done. If I set attributes to paSubClass instead of pa dialog and set
the value in the object inspector everything works correctly, stores the
data into the dfm as expected etc... but I want it to store during the
exit of the dialog form.
please help by explaining how the structure of TPropertyEditor works. I
understand the TComponentEditor but TPropertyEditor is throwing me for a
loop.
thanks
Shannon
 

Re:Re: Component Editor problems

SP wrote:
Quote
another question for you.

How do you store property changes using the propertyeditor.

ok I found the GetComponentNames function from the IDesigner methods but
exactly how do you use it to get the correct TComponent pointer??
Shannon
 

Re:Re: Component Editor problems

SP wrote:
Quote
SP wrote:

>another question for you.
>
>How do you store property changes using the propertyeditor.
>

ok I found the GetComponentNames function from the IDesigner methods but
exactly how do you use it to get the correct TComponent pointer??

Shannon
is there a web site out there that explains property editors throughly?
I have a book but it starts explaining the structure then stops. It
would be really nice if there was a completed examples of property
editors that use padialog, pasubproperties and such instead of them just
going to the point of getting the property to pop up and stops
explaining what the hell is going on.
can you tell this project is starting to get on my nervs.
Shannon
 

Re:Re: Component Editor problems

"SP" < XXXX@XXXXX.COM >wrote in message
Quote
How do you store property changes using the propertyeditor.

I've seen code resembleing this

((Tmyclass*)(component))->myproperty = whatIwant;

but TPropertyEditor doesn't know what component is
Use the editor's GetComponent() method instead:
((TMyClass*) GetComponent(0))->Property = WhatIWant;
Gambit
 

Re:Re: Component Editor problems

"SP" < XXXX@XXXXX.COM >wrote in message
Quote
ok I found the GetComponentNames function from the IDesigner
methods but exactly how do you use it to get the correct TComponent
pointer??
You don't. That is not the correct method to use for this issue.
Gambit
 

Re:Re: Component Editor problems

CRIPS Why didn't I think of doing that. I was trying to do so many
things like that but never thought of placing the 0 as the variable....
Remy Lebeau (TeamB) wrote:
Quote
"SP" < XXXX@XXXXX.COM >wrote in message
news:4256bf07$ XXXX@XXXXX.COM ...


>How do you store property changes using the propertyeditor.
>
>I've seen code resembleing this
>
>((Tmyclass*)(component))->myproperty = whatIwant;
>
>but TPropertyEditor doesn't know what component is


Use the editor's GetComponent() method instead:

((TMyClass*) GetComponent(0))->Property = WhatIWant;


Gambit


 

Re:Re: Component Editor problems

"SP" < XXXX@XXXXX.COM >wrote in message
Quote
CRIPS Why didn't I think of doing that. I was trying to do
so many things like that but never thought of placing the 0 as
the variable....
It is for things like this that reading the included documentation comes in
handy.
Gambit