[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2013-11-11
8
Medium Priority
?
702 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
Independent Software Vendors: 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 28

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

650 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