Well thats not entirely true. While I will in many cases grab a copy of my row for display purposes this is mostly due to a few bugs in Omnis in relation to using objects through object references (which I absolutely love). There are a few enhancement requests for that submitted to Omnis Software as well.
Anyway if I have an object class called oInvoice and inside I have a row variable called ivHeaderRow defined from my table class. I can create a getter and setter method on my object for each column:
$invoiceNumber quit Method ivHeaderRow.invoiceNumber $invoiceNumber.$assign(pvNumber) calculate ivHeaderRow.invoiceNumber as pvNumber
Now on my window where I have an instance variable called ivInvoiceObj of type object reference into which I assign a reference to an instance of my invoice object, I can now set $dataname of my invoice number entry field to ivInvoiceObj.$invoiceNumber
On a redraw Omnis will call my $invoiceNumber method and display the returned value.
When the user changes the value it will call $invoiceNumber.$assign when the user tries to leave the field.
Now this on face value seems to be taking the long way around however now that I have logic on my $invoiceNumber.$assign I can do a lot more then just copy the new value. I can check if the new value is allowed. I can make additional updates to other fields, etc. For me a good example here is changing the amount on an invoice detail. The assign logic doesn’t just update the amount, it calculates the tax, it sums the amounts of all the details together and updates the total amount of the invoice, etc.
As I mentioned to you privately my list of details isn’t actually a list defined from a schema or table class but instead is a list of object references. When I’ve loaded my invoice I actually loop through the details to instantiate an object for each detail and add the object reference to my detail list. Each detail is displayed on my window using its own subwindow which also has the object reference to the detail being shown. It is really amazing what you can achieve GUI wise once you go down this path.
However, and I really stress this, for run of the mill windows, especially in a situation where you’re not working through an API and have direct access to your database, your suggested approach is much easier in so many ways 🙂