NetTalk Central
The Rest Of NetTalk => The Rest - Ask For Help => Topic started by: Niels Larsen on December 12, 2011, 04:10:10 AM
-
Can someone show me how to implement NetRefresh manually on a window - if it can be done.
Regards Niels
-
Can you be more specific on what you are trying to do Niels?
cheers
Bruce
-
Hi Bruce.
Of course! I have a simple window with a lot of box controls. Each box changes color depending on the status of a fire engine.
Everything is controlled by a service on a server which should update my window.
/Niels
-
ok - so is the server writing the info to a file? Or will it pipe the info directly to the client via TCP/IP?
cheers
Bruce
-
For a file. And then the server sends a "refresh" to the client to reset the display.
-
ok, so clearly the problem is in 2 parts;
a) the server has to "send" a notification when the table updates _after_ the change is written to disk.
ThisNetRefresh.Send('|Contacts|')
Make sure there is a pipe char at the start and end of the string. You can add multiple tables to the list if you have updated multiple files.
ThisNetRefresh.Send('|Contacts|Invoices|')
b) The client window has to "respond" to the message. Obviously for a browse this is done by the template for you - the code looks like this;
variable declarations
NetLocalRefreshDate Long
NetLocalRefreshTime Long
NetLocalDependancies String('|Contacts|')
In the dependencies string you'll see again, the pipe separated list of table names, again with the pipe at the start and end of the string.
when you open the screen, or update it,
NetLocalRefreshDate = today()
NetLocalRefreshTime = clock()
If ThisNetRefresh.NeedReset(NetLocalRefreshDate,NetLocalRefreshTime,NetLocalDependancies)
Self.Reset(1)
BRW1.ResetFromBuffer()
End
You would obviously replace
Self.Reset(1)
BRW1.ResetFromBuffer()
with whatever code you need to refresh your window.
Cheers
Bruce
-
Hi Bruce
Thanks. But how do I trigger an event. Do I use a timer or ??
Ii works fine i the window gain focus.
/Niels
-
yes, it works on "any event" - so if you want a consistent event (that does nothing) then I guess the timer event is a good idea.
Set it to say 500 (every 5 seconds) or something like that.
cheers
Bruce
-
Hi Bruce
It should be easy. I have done exactly as you described, but I never get "NeedReset" to be TRUE. Have you got an idea to where I should look for the error?
/Niels
-
Hi Niels,
does your application have a "frame" procedure, or is this window "on it's own" as an app?
cheers
Bruce
-
Yes - I have a frame. I have a browse in the same app and NetRefresh works fine.
Strange....