Assume I have two windows.
In each window there is a button.
Each button caption is “Start”
When you press the button a certain activity begins and the caption changes to “Stop”
Next press stops the activity and caption changes back to “Start”.
Now I want the whole thing to be synchronized since these two buttons actually activate/deactivate the same activity so I want that when either button is pressed both buttons will switch to “Stop” and the activity to start, vice versa when pressed again.
Can this be done and how?
In the Action event handler of your button, or where you are currently changing the caption between “Start” and “Stop”, check for the existence of the other window. If it exists, change the caption of it’s button also.
[code]me.caption = “stop”
for i as integer = 0 to WindowCount
if Window(i) isa window2 then // check if window is your other window
window2(window(i)).PushButton1.caption = “stop” // cast window(i) to your other window, to gain access to it’s controls
You would also need to add the code to your second window’s button to change the caption of the button on your first window.