Thank you Fabrice. I'll take a look at that.
However, your statement has me a little confused. Because if that is
true, then some of the code I currently have shouldn't work.
Currently, from my main window End of Init process, I'm calling the
following code.
CheckConnection()
LoadDefaults()
ThreadExecute("CheckConnectionThread"
,threadNormal,CheckConnectionThreadProcedure)
IF InTestMode() = True THEN
Trace("ThreadRunning:" + threadRunning) Trace("ThreadUnknown:"
+ threadUnknown)
Trace("ThreadSuspended:" + threadSuspended)
Timer(CheckThreads,6000,999)
END
CheckCOnnectionThreadProcedure is a global procedure with the following.
PROCEDURE CheckConnectionThreadProcedure()
LOOP
CheckConnection()
IF InTestMode() = True THEN
Trace("CheckConnectionThread: " +
ThreadState("CheckConnectionThread"))
END
until it is completed.
to ThreadStop calls.
FOR x = 1 TO 6
Wait(500)
END
DO WHILE True = True
PROCEDURE CheckConnection()
xStatus is numeric
xStatus = ServerSettingsV2()
IF xStatus <> 0 THEN
ChangeLight(False)
ELSE
ChangeLight(True)
END
PROCEDURE ChangeLight(bConnected is boolean)
SWITCH bConnected
CASE True:
WIN_Main.IMG_ServerConnectionRed..Visible = False
WIN_Main.IMG_ServerConnectionGreen..Visible = True
gbIsConnected = True
WIN_Main.STC_ConnectionStatus..Visible = True
WIN_Main.STC_ConnectionStatus..Caption = "Connected"
CASE False
WIN_Main.IMG_ServerConnectionRed..Visible = True
WIN_Main.IMG_ServerConnectionGreen..Visible = False
gbIsConnected = False
WIN_Main.STC_ConnectionStatus..Visible = True
WIN_Main.STC_ConnectionStatus..Caption = "Offline"
OTHER CASE
END
Now, I am sure this isn't the most efficient way to accomplish this. I'm
still very much a beginner at programming. However, as you can see the
end result of this thread is changing UI elements on the main window.
Maybe what I'm calling a thread isn't actually a secondary thread?