Solved

Turbopower Orpheus - TOvcTable - When to modify data after user finishes a cell edit

Posted on 2013-11-11
8
661 Views
Last Modified: 2013-11-20
I am using an Orpheus TOvcTable component with good success on a form.  
However, once the user has successfully edited a cell value, I'd like to sort the underlying data and redisplay the data in its sorted form.  The whole set of data for display in the table is only some 20 records of some 4 fields and will be quickly sorted and redisplayed by having the whole table repaint itself.
I can't decide upon which OnXXX event to choose to implement my sorting routine.  There seems to be such interaction between the table and its attached cell editing components that I can't deduce the proper one and proper time to perform this post edit action.  I don't need to change focus to another control from the TOvcTable during the sort's manipulation of the underlying data.
Any insight please?
0
Comment
Question by:scox12
  • 4
  • 3
8 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39640474
onPost should do it
onAfterEdit will not have posted the saved data to the db

closing and reopening the query should work in the onPost
0
 

Author Comment

by:scox12
ID: 39640658
Thanks to Geert_Gruwez for the suggestion.  However, an Orpheus TOvcTable is not a database table but rather a visual component that doesn't have an onPost event.  It does have an OnDoneEdit event that says that it is "called just after the data has been saved from the edited cell."  It cautions that it "is triggered in the middle of a focus change" and that the user "cannot cause another focus change to happen." (from page 1066 of the user manual)
This event was the one that I have come to think would be the one that I should use to trigger my sorting routine.  
Would my assumption be correct?
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39640882
i wasn't talking about the TOvcTable, but the dataset component
usualy TQuery, TTable, TADOTable, etc
I see i didn't indicate that

The TOvcTable will probably be linked to a TDatasource and that will be linked to a TTable (or other TDataset descendant)

there is no point in catching this on the visual component

>> has been saved from the edited cell.
this means the internal visual component (TOvcTable) memory structure

On a side note, how old is TOvcTable ?
I remember using it over a decade ago, but my memory is a little shallow from back then
didn't know it was still around
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 26

Expert Comment

by:Sinisa Vuk
ID: 39640957
Maybe you can use "post" sorting with windows messaging (handle own message):
const WM_MY_ACTION = WM_USER + 100;
...
procedure MsgHandler(var msg : TMessage); message WM_MY_ACTION;
....
procedure TfrmKasa.MsgHandler(var msg: TMessage);
begin
  //do sort here or something else.....
end;

//in some Onxxxxx event:
PostMessage(Self.Handle, WM_MY_ACTION, 0, 0);

Open in new window

0
 

Author Comment

by:scox12
ID: 39642217
Thanks for your continued interest Geert_Gruwez and to sinisav for weighing in.
@Geert_Gruwez: My underlying difficulty is in determining when the modified data has finished being saved and when it's safe to then modify that saved data by other routines.  TOvcTable does not have a linked TTable so I can't simply observe when that has finished being updated.  TOvcTable is designed with the idea of being able to have great flexibility in how it obtains the data that it displays, not just that from a table.  
I'm testing the use of the OnDoneEdit event to see if that event occurs at a point after data updates have completed.  Will report back on success or not.
The TOvcTable does, however, have a descendant class, TOvcDbTable, that is data-aware.   I will look at its source to try to determine when it posts changes to its dataset and use that timing to try to ferret out timing for TOvcTable itself.
@sinisav: Triggering the sort shouldn't be a difficulty, once I figure out when it's safe to do it.  The numerous choices of events triggered by edits of TOvcTable's data are what's giving me pause.  Selecting the last one without violating a focus change is what's scaring me.
Bye-the-bye, Orpheus is actively updated on Sourceforge by maintainers more skilled than I.  It's XE4 compatible and XE5 will soon be achieved.  Thanks, too, to them for ongoing tool maintenance!
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39643809
if it's not a data-aware component then there should be a piece of code to fill up the component
in most components the distinction is given with bound and unbound examples
bound meaning linked to a datasource
unbound meaning, you need to fill the component by code

have you tried creating a separate project to find how the TOvcTable works ?
moving pieces of code from the old to the demo project should help find out how the original project works
0
 

Accepted Solution

by:
scox12 earned 0 total points
ID: 39652697
@Geert_Gruwez: Yes, the component requires binding code, the address of the data item, that points to the particular item at the row/column of the component.  This portion of the code is functional and working correctly.  To some degree the component is semi-data aware with that data item's address performing the transmission of what the user sees in the component into and out of the underlying persistent storage.
I'd hoped that someone would have experience in using the component and could answer my question without too much difficulty.   Perhaps the vintage of the component has worked against that.
I've some DUnit that indicates that the safe location to put post update modifications to the persistent storage's data is in the OnDoneEdit event handler, like so:
procedure TdlgConsumableSort.OvcTableConsumableSortOrderDoneEdit
  ( Sender : TObject; RowNum, ColNum : Integer );
var
  PostEditData : TGridColumnInfo;
begin
  inherited;
  PostEditData := FvFileSortMgrForConsumableVTable.GridColumnInfoArray
    [ RowNum ];
  if DataWasEdited( PostEditData ) then begin
    SortTableData( PostEditData, RowNum );
  end;
end;

Open in new window

Where the method SortTableData has access to the whole GridColumnInfoArray array.
This solves my difficulty and can be accepted as the solution.
Thank you all for your help and time.
0
 

Author Closing Comment

by:scox12
ID: 39662092
Experimentation with the component's various event handlers that are triggered when the user edits the values displayed to the user, allowed me to track down the event handler to use.  That is the OnDoneEdit event handler.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 149
When i run adoquery my application freezes 26 178
How to convert memory stream to PDF file 6 107
Delphi problems to abort a printjob 9 24
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question