| View previous topic :: View next topic |
| Author |
Message |
Dmitry Guest
|
Posted: Wed Apr 25, 2007 8:11 am Post subject: force writing property values to Form |
|
|
Hi All,
I implement a PropertyEditor for component.
A component has TStrings properties that my PropertyEditor edits.
I can change Strings property values in my Property editor and can see
that changes are visible.
But when i run application i discover that Strings properties of the
component still contain OLD values.
It looks like properties are not forced to save to VCL streaming system to
save values on the form.
I guess there is special method to make sure property value saved on form.
please help.
Dmitry. |
|
| Back to top |
|
 |
Dmitry Guest
|
Posted: Wed Apr 25, 2007 7:41 pm Post subject: Re: force writing property values to Form |
|
|
hopefully i find this problem.
In my PropertyEditor i call Modified()
which informs Designer about changes.
Dmitry |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 25, 2007 9:33 pm Post subject: Re: force writing property values to Form |
|
|
"Dmitry" <dmitry (AT) pikalevo (DOT) com> wrote in message
news:462ef4a0 (AT) newsgroups (DOT) borland.com...
| Quote: | But when i run application i discover that Strings
properties of the component still contain OLD values.
|
Then you likely did not set up the property correctly in your
component's code. Please show your actual code.
Gambit |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 25, 2007 9:34 pm Post subject: Re: force writing property values to Form |
|
|
"Dmitry" <dmitry (AT) pikalevo (DOT) com> wrote in message
news:462f6876$1 (AT) newsgroups (DOT) borland.com...
| Quote: | In my PropertyEditor i call Modified()
which informs Designer about changes.
|
That informs the Object Inspector and Form Designer that they need to
update their displays. But that has no effect on the property's
ability to be streamed to/from the DFM. Those are separate
operations.
Gambit |
|
| Back to top |
|
 |
Dmitry Guest
|
Posted: Wed Apr 25, 2007 11:28 pm Post subject: Re: force writing property values to Form |
|
|
Hi Remy
| Quote: | Then you likely did not set up the property correctly in your
component's code. Please show your actual code.
|
void __fastcall TDataSetSQLPropertyEditor::Edit()
{
TDataSetSQLStringsForm *a_PropForm = NULL;
try
{
TDacDataSet *a_DataSet = dynamic_cast<TDacDataSet *>(GetComponent(0));
if(!a_DataSet) throw Exception("GetComponent(0) is not TDacDataSet");
if(!a_DataSet->Connection)throw Exception("Connection property is not
assigned!");
a_PropForm = new TDataSetSQLStringsForm(NULL, a_DataSet);
a_PropForm->ctl_DataSetName->Text = a_DataSet->DataSetName;
a_PropForm->ctl_SelectSQL->Text = a_DataSet->SelectSQL->Text;
a_PropForm->ctl_InsertSQL->Text = a_DataSet->InsertSQL->Text;
a_PropForm->ctl_UpdateSQL->Text = a_DataSet->UpdateSQL->Text;
a_PropForm->ctl_DeleteSQL->Text = a_DataSet->DeleteSQL->Text;
a_PropForm->ctl_GetRecordSQL->Text = a_DataSet->GetRecordSQL->Text;
a_PropForm->ctl_Ok->Enabled = false;
a_PropForm->ctl_SaveToRepository->Enabled = false;
if(a_PropForm->ShowModal() == mrOk)
{
a_DataSet->SelectSQL->Assign(a_PropForm->ctl_SelectSQL->Lines);
a_DataSet->InsertSQL->Assign(a_PropForm->ctl_InsertSQL->Lines);
a_DataSet->UpdateSQL->Assign(a_PropForm->ctl_UpdateSQL->Lines);
a_DataSet->DeleteSQL->Assign(a_PropForm->ctl_DeleteSQL->Lines);
a_DataSet->GetRecordSQL->Assign(a_PropForm->ctl_GetRecordSQL->Lines);
a_DataSet->DataSetName = a_PropForm->ctl_DataSetName->Text;
Modified();
}
}
__finally
{
delete a_PropForm;
}
}
if i dont use Modified() then after close/open the project with my
component - no changes are saved.
i noticed that Modified() makes IDE button SaveAll to enable, so it forces
IDE to save form DFM before
compilation and before close.
tx
Dmitry. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Apr 26, 2007 12:22 am Post subject: Re: force writing property values to Form |
|
|
"Dmitry" <dmitry (AT) pikalevo (DOT) com> wrote in message
news:462f9db1 (AT) newsgroups (DOT) borland.com...
| Quote: | void __fastcall TDataSetSQLPropertyEditor::Edit()
|
I was referring to your component's code, not your editor's code.
Gambit |
|
| Back to top |
|
 |
Dmitry Guest
|
Posted: Thu Apr 26, 2007 8:11 am Post subject: Re: force writing property values to Form |
|
|
| Quote: | I was referring to your component's code, not your editor's code.
|
the component 's
SelectSQL
InsertSQL
UpdateSQL
DeleteSQL
are simple TString properties.
__property TStrings *SelectSQL = {read = m_SelectSQL, write =
SetSelectSQL};
.....
void __fastcall TDacDataSet::SetSelectSQL(TStrings *p_Value)
{
m_SelectSQL->Assign(p_Value);
}
Dmitry |
|
| Back to top |
|
 |
|