On Feb 6, 2006, at 5:56 PM, Mark Cooke wrote:
Hi,
I'm writing a very simple account program (only for myself), not
coming from an event or Multiple window coding environment (mainly
terminal based programs), I was wondering of the best and cleanest way
of passing data between two windows.
Here my setup:
I have MainWindow, this holds A toolbar with New, Edit and Delete
toolbaritems, under this is a 8 column ListBox,
this holds each transaction for the current window.
If you Click New or Edit, this opens up the relevant window, here you
can add the new transaction infomation to several
EditFileds and Checkboxes etc..,
It's at this point, I'm wondering about the best way to pass the data
back to the MainWindow.LBTransactions.
At present I have some very simple code in the SaveButton for the
Action Event, in the TransactionsWindow, it does some validation and
checking of the data in this window, then passes the details back to
the MainWindow.LBTransactions, using the details below.
MainWindow.LBTransactions.addrow ""
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,0
)= DateField.Text
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,1)
= AmountField.Text
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,2)
= DescriptionComboBox.Text
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,3)
= CategoryComboBox.Text
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,4)
= PaymentMethodComboBox.Text
MainWindow.LBTransactions.cell(MainWindow.LBTransactions.lastIndex,6)
= NotesField.Text
This looks very messy and clumsy, the other option could be to use a
For..Loop, and inside this add a Select Case to populate the required
cells of the ListBox.
Any advise would be appreciated.
I'd suggest not passing the transaction directly back to the window
containing the list. Instead, use a third object, which would probably
be implemented as a module. When you save a transaction, pass it to
this object. It can then notify other objects that a transaction has
been changed.
--------------
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>