[SOLVED] how to refresh data in TDBMemo? lazarus / 16-Databases ---------------------------------------------------------------------- eara · 2014-04-15 10:46 i have a db form with a TDBMemo control e.g. edt_authors the control  is bound to a db text field and want to keep small in size so i designed it like the other TDBEdit fields in my form, to occupy a single line. Now in case the user want to put there a large amount of authors, i have a seperate form for editing text fields, lets say dlgTextFieldEditor which holds a big TDBMemo, lets say edt_big_memo. When user calls this form, i set edt_big_memo.Datasource:=edt_authors.Datasource edt_big_memo.DataField:=edt_authors.DataField and show form as modal. When user is finished with editing and closes the form with the edt_big_memo the edt_authors is not updated, but the underlying field it is. This is my problem, how to update the edt_authors to reflect the changes, without posting the record ? ---------------------------------------------------------------------- JanRoza · 2014-04-15 11:07 Have you tried edt_big_memo.refresh? ---------------------------------------------------------------------- eara · 2014-04-15 11:28 i think i have. I change course now and i try with TMemo editor ... ---------------------------------------------------------------------- kpeters58 · 2014-04-15 20:56 Maybe I am missing the point: What's wrong with posting the data? As long as you don't do any ApplyUpdates, the data won't be in your database... (assuming you're using an access layer like SqlDB) ---------------------------------------------------------------------- eara · 2014-04-15 22:48 the point was that user sees in a db form an edit box with lots of data and he presses the button next to it which opens a seperate big editor window, and do his changes there. Finally he presses the ok button and looks back to the edit box which still has the old value, but the bound TField has the changes which user can't see. Anyway, solution was simple i replaced TDBMemo in dlgTextField dialog with TMemo, and i copy value from edit control to edit control without Tfield interfearance. ---------------------------------------------------------------------- kpeters58 · 2014-04-17 16:04 Wouldn't a simple table/query refresh have done this? ---------------------------------------------------------------------- eara · 2014-04-18 00:04 Quote from: kpeters58 on April 17, 2014, 06:04:39 pmWouldn't a simple table/query refresh have done this? plz read my scenario, i am in the middle of an EDIT operation so refresh what ? it is something that has to do with TEXT fields that are handled like BLOBS, so mayby for optimization reasons (i don't know really, i just suspect) underlying TField is not immediatly updated from TDBMemo control until changes going to db. I fall again in a similar case in event OnBeforePost where i want to validate or manipulate data in an TDBMemo control which is bound to a TEXT Field in MySQL (that means looooooong text), and i avoid to use the value from FieldByName cause is not returning all the data from the TDBMemo, instead i use the TDBMemo.Text... anyway don't bother more with that... as i mention before solution is simpler: i used a TMemo and i copy text from control to control (instead from control to field) ---------------------------------------------------------------------- taazz · 2014-04-18 04:20 first and most important please create a small demo showing that problem. The rest follows. Quote from: eara on April 18, 2014, 02:04:07 amQuote from: kpeters58 on April 17, 2014, 06:04:39 pmWouldn't a simple table/query refresh have done this? plz read my scenario, i am in the middle of an EDIT operation so refresh what ? it is something that has to do with TEXT fields that are handled like BLOBS, so mayby for optimization reasons (i don't know really, i just suspect) underlying TField is not immediatly updated from TDBMemo control until changes going to db. No a dataset is a client side cursor and it should behave like one, when data are changed from one component it automatically reflectst the changes to all the components that show those data. Data change includes but is not limited to scrolling the dataset changing the datasets state and of course changing the data of a single field on the active record. Any of the above operations should change the visual data on all linked components. Quote from: eara on April 18, 2014, 02:04:07 amI fall again in a similar case in event OnBeforePost where i want to validate or manipulate data in an TDBMemo control which is bound to a TEXT Field in MySQL (that means looooooong text), and i avoid to use the value from FieldByName cause is not returning all the data from the TDBMemo, instead i use the TDBMemo.Text... da! FieldByname returns the tfield in client side that holds the data to be used. If you do MyDatasets.FieldByname('Myfield').Value should return all the data if it is not then please provide with a demo to look at what you describe is not possible as far as I know. Quote from: eara on April 18, 2014, 02:04:07 am anyway don't bother more with that... as i mention before solution is simpler: i used a TMemo and i copy text from control to control (instead from control to field) Yeah that is a work around not a solution and it is something you do to avoid problems with the underline component suite again a demo would be required at this point what you describe it should never happen and if does happens then there are bugs that need to be reported. ---------------------------------------------------------------------- eara · 2014-04-18 23:30 QuoteYeah that is a work around not a solution and it is something you do to avoid problems with the underline component suite again a demo would be required at this point what you describe it should never happen and if does happens then there are bugs that need to be reported well ...  it is a solution, as long as it solves problems, and the biggest problem of all is .... TIME! I made a test program that reproduces what i did. Mayby i made things wrong, mayby not, i don't know, take a look if you want... ---------------------------------------------------------------------- taazz · 2014-04-19 00:25 thank you I will after the holidays. ---------------------------------------------------------------------- kpeters58 · 2014-04-19 18:10 procedure TForm1.returnClick(Sender: TObject); begin   GroupBox1.Enabled:=True;   GroupBox2.Enabled:=False;   DBMemo2.EditingDone;   DBMemo2.ReadOnly:=true;   //   DBMemo1.Text :=  DBMemo2.Text;   DBMemo1.Refresh;   DBMemo2.DataSource:=nil;   DBMemo2.DataField:=''; end; ---------------------------------------------------------------------- eara · 2014-04-19 19:11 merci for your time... I got the point...  DBMemoX.Text:=DBMemoY.Text actually this is what i doing now with Memo : Memo.Text := DBMemo.Text