Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delphi to VFP 8.0 SP1 - Branching
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Delphi to VFP 8.0 SP1 - Branching
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01518631
Message ID:
01518631
Views:
110
Hello Gurus!

I am converting this Delphi code
procedure TfrmITM.tmrWaitTimer(Sender: TObject);
var
   nPort : Integer;
begin
     tmrWait.Enabled := false;
     if CheckQuit() then begin
        ClaimsTable.Active := false;
        ClaimsTable.Close;
        IPTable.Active := false;
        IPTable.Close;
        application.Terminate;
        exit;
     end;
     if CheckToSend then begin
        gPriority := 1;
        IpTable.Locate('Priority', gPriority, []);
        gIPAddress := IPTable.FieldByName('ip_address').AsString;
        nPort := ClaimsTable.FieldByName('port').AsInteger;
        if (gIPAddress <> ClientSocket.Address) or (nPort <> ClientSocket.Port) then begin
           Disconnect();
           Statusbar.Panels[0].Text := 'Address:' + gIPAddress;
           Statusbar.Panels[1].Text := 'Port:' + IntToStr(nPort);
           lblSwitch.Caption := 'MedEAmerica';
           ClientSocket.Address := gIPAddress;
           ClientSocket.Port := nPort;
        end;
        if not gConnected then
           Connect()
        else MedETransmit();
     end else
        tmrWait.Enabled := true;
end;
into VFP 8.0 SP1 code..... as below
LOCAL nPort as Integer

Thisform.tmrITMWait.Enabled = .F.

**************************************************************************************************************
*Code to execute to send or receive data to/from Switch for processing.....

*Check to see if we need to QUIT and terminate the ITM and ECM
IF Thisform.p_ITM.m_CheckQuit()
	Thisform.tmrITMTimeout.Enabled = .F.
	Thisform.tmrITMWait.Enabled = .F.
	Thisform.tmrSendReceive.Enabled = .F.
	Thisform.tmrTALK.Enabled = .F.
	Thisform.m_end()
	QUIT 
ENDIF 
*Check to see if see if need to send a claim to the Switch
IF Thisform.p_ITM.m_CheckToSend()
	Thisform.p_ITM.p_priority = 1
	SELECT ITM_addresses
	GO top
	LOCATE FOR priority = Thisform.p_ITM.p_priority
	Thisform.p_ITM.p_IPaddress = ALLTRIM(ITM_IPAddress.IP_Address)
	Thisform.p_ITM.p_Port = ITM_Claims.port	
	IF (Thisform.p_ITM.p_IPaddress <> Thisform.p_ITM.p_Clientsocketipaddress) OR ;
		(Thisform.p_ITM.p_Port <> Thisform.p_ITM.p_Clientsocketipport)
		Thisform.lblPanel0.Value = 'Address:' + ALLTRIM(Thisform.p_ITM.p_Clientsocketipaddress)
		Thisform.lblPanel1.Value = 'Port:' + ALLTRIM(STR(Thisform.p_ITM.p_Clientsocketipport))
		Thisform.lblSwitchConnection.Value = 'MedAmerica'
		Thisform.p_ITM.p_Clientsocketipaddress = Thisform.p_ITM.p_IPaddress
		Thisform.p_ITM.p_Clientsocketipport = Thisform.p_ITM.p_Port
	ENDIF
	IF NOT Thisform.p_ITM.p_connected
		Thisform.p_ITM.m_Connect()
	ELSE
		Thisform.p_ITM.m_MedETransmit()
	ENDIF  
ELSE
	Thisform.tmrITMWait.Enabled = .T.	
ENDIF 

is this correct branching? Or is this correct? (moving the Thisform.tmrITMWait.Enabled = .T. to be the last line of code and
always execute to restart the timer?
LOCAL nPort as Integer

Thisform.tmrITMWait.Enabled = .F.

**************************************************************************************************************
*Code to execute to send or receive data to/from Switch for processing.....

*Check to see if we need to QUIT and terminate the ITM and ECM
IF Thisform.p_ITM.m_CheckQuit()
	Thisform.tmrITMTimeout.Enabled = .F.
	Thisform.tmrITMWait.Enabled = .F.
	Thisform.tmrSendReceive.Enabled = .F.
	Thisform.tmrTALK.Enabled = .F.
	Thisform.m_end()
	QUIT 
ENDIF 
*Check to see if see if need to send a claim to the Switch
IF Thisform.p_ITM.m_CheckToSend()
	Thisform.p_ITM.p_priority = 1
	SELECT ITM_addresses
	GO top
	LOCATE FOR priority = Thisform.p_ITM.p_priority
	Thisform.p_ITM.p_IPaddress = ALLTRIM(ITM_IPAddress.IP_Address)
	Thisform.p_ITM.p_Port = ITM_Claims.port	
	IF (Thisform.p_ITM.p_IPaddress <> Thisform.p_ITM.p_Clientsocketipaddress) OR ;
		(Thisform.p_ITM.p_Port <> Thisform.p_ITM.p_Clientsocketipport)
		Thisform.lblPanel0.Value = 'Address:' + ALLTRIM(Thisform.p_ITM.p_Clientsocketipaddress)
		Thisform.lblPanel1.Value = 'Port:' + ALLTRIM(STR(Thisform.p_ITM.p_Clientsocketipport))
		Thisform.lblSwitchConnection.Value = 'MedAmerica'
		Thisform.p_ITM.p_Clientsocketipaddress = Thisform.p_ITM.p_IPaddress
		Thisform.p_ITM.p_Clientsocketipport = Thisform.p_ITM.p_Port
	ENDIF
	IF NOT Thisform.p_ITM.p_connected
		Thisform.p_ITM.m_Connect()
	ELSE
		Thisform.p_ITM.m_MedETransmit()
	ENDIF  
ENDIF 

Thisform.tmrITMWait.Enabled = .T.	
And other branching problems toward the end? The Begin / If / Then / Else commands are similar BUT.....a little different.
Tommy Tillman A+ NetWork+ MCP
Reply
Map
View

Click here to load this message in the networking platform