Updating data aware controls

Updating data aware controls

Post by Paul Slei » Fri, 01 Sep 1995 04:00:00



Here's a puzzle.  I've mailed the Amazing Steves personally,
(I hope they're not too miffed at being mailed directly)
but I'll let the rest of the net have a crack at it too.

I'm using Delphi at work to write a phone message recorder:
multiple users (up to six at a time) would have it running minimized,
and when they take a phone call they use it to type in and recall details
-- who called, when, what they were calling about, and so on.

The details of all our customers are stored in one database table,
the details of all the recent messages are stored in another.
But there doesn't seem to be a way for one instance of the program
to notify all other instances on other computers at the same time,
if either database changes.
I have a "table of contents" displaying both databases on the form,
and I want that table of contents to update automagically whenever a
customer or message is inserted, deleted or edited.

How do I do this?  It's driving me batty!

: Paul Sleigh :
--
------------------------------------------------------------------------------
I can face anything, except the future,  |  Eric the Fruitbat, aka Paul Sleigh
and certain parts of the past            |  In the SCA: Eric of Tobar Mhuire

 
 
 

Updating data aware controls

Post by Fifth Avenue Collecti » Fri, 01 Sep 1995 04:00:00



Sleigh) said:

Quote:>The details of all our customers are stored in one database table, the
details  
>of all the recent messages are stored in another. But there doesn't seem
to be  
>a way for one instance of the program to notify all other instances on
other  
>computers at the same time, if either database changes.
>I have a "table of contents" displaying both databases on the form, and I
want  
>that table of contents to update automagically whenever a customer or
message  
>is inserted, deleted or edited.

The approach I've seen used most often is to simply have each instance
refresh its screen from the database every several seconds.  This way, no
communication is necessary between instances of your app.

Quote:>How do I do this?  It's driving me batty!

                                    ^^^
A subtle play on words, perhaps?
--
Jim Robb            Fifth Avenue Collection        
Moose Jaw, SK       Voice  (306) 694-8188     Fax (306) 694-0610          
Sioux Falls, SD     Voice  (605) 335-0602     Fax (605) 335-0713

 
 
 

Updating data aware controls

Post by Reza Bin Raqui » Fri, 01 Sep 1995 04:00:00


Have you tried attaching the TTable's refresh method to a TTime's ontimer
event?

===============================================================
Name:    Reza Bin Raquib            Phone : 667-3000 x 227

"For off-shore pricing on Printing, Data entry, CAD conversion,
 and Software development project please call."
===============================================================

 
 
 

Updating data aware controls

Post by TFas » Tue, 05 Sep 1995 04:00:00



Quote:

>Have you tried attaching the TTable's refresh method to a TTime's ontimer
>event?

Yes, this is how it is implemented in Paradox.  There is no way to
communicate between other BDE instances unless you write it yourself.

Todd
--
=======================================================

"His mind is somewhat too much taken up with his mind." - John Earle
=======================================================

 
 
 

Updating data aware controls

Post by Paul Slei » Wed, 06 Sep 1995 04:00:00


Just so the lurkers can have some sense of completion here...

My problem was this:
User A and User B are both using a program.
The program accesses some tables and displays them in various ways,
including an OwnerDraw TListBox
listing the first half dozen fields of each of one table's records.

If User A makes a change to a table,
and User B presses some sort of "Reread" button,
then User B's instance of the fields and contents will be up to date.
However, having a Reread button seemed silly to me.

What I've done is this:
I created a table called "UPDATE.DB", with three fields:
TableName, a string;
Date, a long integer; and
Time, a long integer.

Using the Database Desktop,
I set up a record in this table for each other table I'm using.
It looked something like this:
['APPLE-TABLE',0,0]
['BAT-TABLE',0,0]
['CAMEL-TABLE',0,0]
etc etc etc

I then created an object that contains a reference to such a table,
plus a LongInt each for Date and Time.

Now, whenever User A or B accesses the table of contents,
the object I defined checks in the relevant row of the Update table,
and checks to see if its own Date and Time match the ones stored there.
If they don't, the "Modified" property of that object returns True,
and incidentally sets Date and Time to the values stored there.

Also, to the OnAfterPost method of the various tables (Apple, Bat, Camel,
etc) I added a call to that same object's Modify procedure,
which simply stores the current date and time, as long integers,
in the relevant rows of the update table.

I can connect this to a timer too,
as someone suggested,
to make it check the update table every second or so.

Since it only updates when it has to,
it seems like as close as I can get to an ideal method.
I do wish I could access the table's DOS access-time-and-date stamp,
but failing that this seems to be the best way.

Thanks to all of you for your suggestions.

: Eric :
--
------------------------------------------------------------------------------
I can face anything, except the future,  |  Eric the Fruitbat, aka Paul Sleigh
and certain parts of the past            |  In the SCA: Eric of Tobar Mhuire

 
 
 

1. Data-aware controls that be aware of nothing

I'm puzzled (but I'm not a guru) with this.

I want to insert data into two tables through two TQuery in
a Client/server application. Both tables are related in a
master/detail relationship with a field (NH) that is the
primary key in the master table. The detail table has
another primary key (NI).

I've built a form divided into two moities with data-aware
controls for fields from both Tquery. In the OnCreateForm
procedure  I start a explicit transaction, and prepare, open
and insert on both TQuery.

The problem is that the controls which have to be aware of
the fields of the first TQuery do it OK, but not the others.
And I know that the record in the second TQuery is inserted
and in dsInsert mode, because I can assign values to this
record through code, but not through the data-aware
controls.

Can anybody help me?

Thanks.

Sent from RemarQ http://www.remarq.com/?z The Internet's Discussion Network
The fastest and easiest way to search and participate in Usenet - Free!

2. FileName and FTP

3. Data Aware OCXs and Data Controls

4. Joe Celko

5. Non-Data aware controls and ADO

6. NuBQ: Using MTS to cache information

7. Data aware (bindable) user control (HOW TO?)

8. ::..Oracle Financials Programmer/Analyst::Portland, Oregon..:: jwdr10001

9. URGENT Writing the contents of data-aware controls to the database TOUGH ONE

10. Data Aware Controls

11. clipboard cut/paste with many data aware controls

12. HELP - need fast data-aware TDBOutline control

13. Data aware controls and Microsoft Access