Hi.
When user click NewItemRow, I want to show default value, not blank.
So I coded OnFocusedRecordChanged following.
void __fastcall TMainForm::DetailTableFocusedRecordChanged(
TcxCustomGridTableView *Sender,
TcxCustomGridRecord *APrevFocusedRecord,
TcxCustomGridRecord *AFocusedRecord,
bool ANewItemRecordFocusingChanged)
{
if (ANewItemRecordFocusingChanged && !AFocusedRecord)
{
Sender->DataController->Values[Sender->DataController->FocusedRecordIndex][1] = "0";
Sender->DataController->Values[Sender->DataController->FocusedRecordIndex][2] = 1;
Sender->DataController->Values[Sender->DataController->FocusedRecordIndex][3] = "0";
Sender->DataController->Values[Sender->DataController->FocusedRecordIndex][4] = "0%";
}
}
To add new row, click <Click here to add a new row>. Column1,2,3,4 shows "0", 1, "0", "0%". But click cell to edit value and click another column when editing done, It changed to blank.
I have same problem with TcxCustomEdit->OnEditValueChanged. But it is solved.
TcxCustomEdit->PostEditValue();
In short, I want to set default value when NewItemRow appeared. How can I do it?
Unbound mode and DetailTableView
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Ilgyu.
Thank you for your message.
To achieve the desired result, use the DataController's SetEditValue method as follows:
void __fastcall TMainForm::DetailTableFocusedRecordChanged( TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged) { if (ANewItemRecordFocusingChanged && !AFocusedRecord) { Sender->DataController->SetEditValue(1, "0", evsValue); Sender->DataController->SetEditValue(2, 1, evsValue); Sender->DataController->SetEditValue(3, "0", evsValue); Sender->DataController->SetEditValue(4, "0%", evsValue); } }
Please refer to the "TcxCustomDataController.SetEditValue" topic of the ExpressQuantumGrid documentation to learn more about this functionality. Also, please note that the evsValue element is declared in the cxDataUtils unit. So, you should include it to your project.
Hopefully, it will help you achieve the required functionality.
Best regards,
Ingvar.
Thanks. It works perfectly!
I was impressed by customer support of your company. DevExpress is the best component tool that I've ever met.
Hello Ilgyu.
You are always welcome! :)
Best regards,
Ingvar.