Board index » cppbuilder » How to refresh all control on Tab ?

How to refresh all control on Tab ?


2004-07-14 08:19:26 AM
cppbuilder89
Hi,
That question is so basic that I'm surprised that I can't find the answer in
documentation.
I would like to set the controls values taken from the remote system only
when Tab is activated or if user change server connection (so constructor is not
an option).
To do that I added new Component inherited from TEdit with modified Update
method.
I would like to call this method for active TabSheet when user switch Tabs
or when user change server.
Problem is that Update is never called.
How can I force the TabSheet to call Update() for all controls on the sheet?
I tried to add my own OnShow() method and call
PaintControls( GetDeviceContext(&WindowHandle), NULL);
inside but it doesn't work. I see that OnShow is activated but I don't
see any Window Messages flowing.
I also don't see Update function is called when I put other window on top of
my application to force refresh.
May be the original Update() from TEdit is called instead of my function?
Any help will be appreciated
Jacek
 
 

Re:How to refresh all control on Tab ?

Use the TTabSheet OnShow event.
Update() is for window painting,
which is not what you are looking for.
Todd
"Jacek Dobaczewski" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...
Quote
Hi,
That question is so basic that I'm surprised that I can't find the answer in
documentation.

I would like to set the controls values taken from the remote system only
when Tab is activated or if user change server connection (so constructor is not
an option).
To do that I added new Component inherited from TEdit with modified Update
method.
I would like to call this method for active TabSheet when user switch Tabs
or when user change server.

Problem is that Update is never called.
 

Re:How to refresh all control on Tab ?

I'm a bit confused as to where a server comes into it - could you
explain that bit please?
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

{smallsort}

Re:How to refresh all control on Tab ?

"Andrue Cope [TeamB]" wrote:
Quote

I'm a bit confused as to where a server comes into it - could you
explain that bit please?

I was very busy solving the problem as I was not patient enough to wait
for the answer from news group, so my answer is two weeks late, but any way:
I'm still a little bit confused with Update() but looks like my solution works.
When user switch the tab OnShow event call my method which go through all
elements on the Tab calling their Update() function.
I would prefer to use my own method instead of Update(), but recognizing my
Components from all possible Components on the Tab looked complicated for me.
Each Update() function use additional properties of my Components to find
the string which has to be send to Server asking for element state.
Component add special object to commands list on Connection Thread.
This object has two methods:
- one: getCommand() for taking the command string
- second: NewData() which has to be called when data arrive.
When all Update() are called the Connection Thread has list of commands which
has
to be send to Server. Thread execute the commands one by one and when data
arrive
the appropriate method from my Component is called in Synchronize()
to interpret the data and update the graphic of my Component.
What surprise me, I don't have to call parent class Update() of Invalidate()
method to make this working.
To avoid Update() function to bother the Server each time when screen has
to be refreshed, I use special Tag property, to let redefined Update() method
of my Components know that Update() was called from OnShow method and actual
data has to be taken from Server.
A little bit complicated, but works. Any more elegant methods are welcomed.
Now I have new problem:
As long as Update() functions are called the components can't be updated because
their NewData() functions are called by Synchronize().
I would like to know the state of first Component on the Tab when I take data
for next. I don't know how to stop for a moment to wait for first element
to be refreshed before I will go farther. Sleep() function doesn't work.
I have to kick of Window message loop some how, but I don't know how?