?
Solved

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

Posted on 2013-11-11
8
Medium Priority
?
686 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 38

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 38

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

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 38

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 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