This form is for users Provides the option to post predefined comments from the list, accessed through a pop-up window equivalent to triggered by TBitButton; however, once the selected text is added to TDBMemo and the user clicks anywhere, the added value will disappear – again , Not the typed text.
This is the code of the job:
var NoteString: String;
if DBMemo1.Text <>'' then
begin
NoteString := frmSelectNoteCodeView.GetTextfromField + '-' + User.ID
+ 'on' + FormatDateTime('mm/dd/yyyy', Now);
DBMemo1.Text := dbedComments.Text + #13#10 + NoteString;
end;
This is a purposeful code snippet (if the field is empty, only the value is assigned). I am posting this code snippet because I think this is the problem, that is, can’t regular allocation be used with TDBMemo?
The thing is: the user click event is not processed. Any thoughts on why the posted text disappeared?
I will do something like this
var
ADataSet: TDataSet;
begin
ADataSet := DBMemo1.DataSource.DataSet; //just to reduce typing
if not (ADataSet.State in [dsInsert, dsEdit) then
ADataSet.Edit;
ADataSet.FieldByName(DBMemo1.FieldName).AsString :='your text goes here';
ADataSet.Post;
end;
Or you can leave it to the user to call Post.
If .Post is in the last block, it may be better.
By the way, your problem stems from the db-aware control of Delphi’s db-aware framework The strict control imposed by the screen display. Generally speaking, this will discourage you from trying to directly change the content displayed by these controls; if you want to change the data set data, change it, not the data displayed by the associated control.
< /div>
I have a rather strange problem, I cannot find the document. I have a Delphi program that uses Delphi’s built-in TDBMemo component, because the component needs to extract data from a field in the database. The user must also Able to edit this information, that is, add the information to the component’s field. The text typed in the field is visible and will not disappear; however, this is not my problem.
The form is provided for users The option to publish predefined comments from the list is accessed through a pop-up window equivalent to triggered by TBitButton; however, once the selected text is added to TDBMemo and the user clicks anywhere, the added value will disappear – again, Not typed text.
This is the code of the job:
var NoteString: String;
if DBMemo1.Text <>'' then
begin
NoteString := frmSelectNoteCodeView.GetTextfromField + '-' + User.ID
+ 'on' + FormatDateTime('mm/dd/yyyy', Now);
DBMemo1.Text := dbedComments.Text + # 13#10 + NoteString;
end;
This is a purposeful code snippet (if the field is empty, only the value is assigned). I am posting this code snippet because I think this Is the problem, that is, regular distribution cannot be used with TDBMemo?
The thing is: the user click event is not processed. Any thoughts on why the posted text disappeared?
As I said in the comments, TDBMemo is a data-aware control, which means that it is set to display the text of the relevant field in the data set; you You can’t just populate a value into its text attribute, because any time TDBMemo is told to refresh itself (via its TDatalink), it will retrieve the text from the field, overwriting whatever you think you assigned to it.
I will do something like this
var
ADataSet: TDataSet;
begin
ADataSet := DBMemo1. DataSource.DataSet; //just to reduce typing
if not (ADataSet.State in [dsInsert, dsEdit) then
ADataSet.Edit;
ADataSet.FieldByName(DBMemo1.FieldName).AsString: ='your text goes here';
ADataSet.Post;
end;
Or you can leave the user to call Post.
If.Post In the last block, it might be better.
By the way, your problem stems from the strict control imposed by Delphi’s db-aware framework on the screen display of the db-aware control. Generally speaking , This will discourage you from trying to directly change the content displayed by these controls; if you want to change the data set data, change it instead of the data displayed by the associated control.
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3110 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC