115 lines
3.9 KiB
Plaintext
115 lines
3.9 KiB
Plaintext
Compile function NDW_TEST_WAFER_REPORT_EVENTS(CtrlEntId, Event, @PARAMS)
|
|
#pragma precomp SRP_PreCompiler
|
|
#window NDW_TEST_WAFER_REPORT
|
|
|
|
Declare function Get_Property, Utility, Environment_Services, Error_Services
|
|
Declare subroutine Set_Property, Send_Message, Placedialog, Test_Run_Services, Msg
|
|
|
|
// Update the arguments so that the OpenInsight OLE event will treate the ActiveX event as a native event handler.
|
|
If Event EQ 'OLE' then
|
|
Transfer Event to OIEvent
|
|
Transfer Param1 to Event
|
|
Transfer Param2 to Param1
|
|
Transfer Param3 to Param2
|
|
* Transfer Param4 to Param3
|
|
* Transfer Param5 to Param4
|
|
* Transfer Param6 to Param5
|
|
* Transfer Param7 to Param6
|
|
* Transfer Param8 to Param7
|
|
end
|
|
|
|
GoToEvent Event for CtrlEntId else
|
|
// Event not implemented
|
|
end
|
|
|
|
Return EventFlow or 1
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// EVENT HANDLERS
|
|
//-----------------------------------------------------------------------------
|
|
|
|
Event WINDOW.CREATE(CreateParam)
|
|
GoSub InitializeForm
|
|
GoSub SetupOLEControls
|
|
|
|
End Event
|
|
|
|
Event OLE_FROM_CAL.OnSelChange(FirstDate)
|
|
SelectedDate = Get_Property(CtrlEntId, 'OLE.Selection')
|
|
Set_Property(@Window : '.OLE_SCHEDULE', 'OLE.Date', SelectedDate)
|
|
Set_Property(@Window : '.EDL_FROM','TEXT', OCONV(SelectedDate,'DT4/HS'))
|
|
|
|
End Event
|
|
|
|
Event OLE_TO_CAL.OnSelChange(FirstDate)
|
|
SelectedDate = Get_Property(CtrlEntId, 'OLE.Selection')
|
|
Set_Property(@Window : '.OLE_SCHEDULE', 'OLE.Date', SelectedDate)
|
|
Set_Property(@Window : '.EDL_TO','TEXT', OCONV(SelectedDate,'DT4/HS'))
|
|
|
|
End Event
|
|
|
|
Event PUB_DIR_BROWSE.CLICK
|
|
value = "Select a directory" : @fm : "c:\temp"
|
|
dir = Utility( "CHOOSEDIR", @window, value)
|
|
|
|
if dir NE '' then
|
|
Set_Property(@Window : '.EDL_SAVE_TO_PATH', 'TEXT', dir: '\')
|
|
end
|
|
|
|
end event
|
|
|
|
Event PUB_RUN.CLICK()
|
|
SavePath = Get_Property(@Window : '.EDL_SAVE_TO_PATH', 'TEXT')
|
|
FileName = Get_Property(@Window : '.EDL_FILE_NAME', 'TEXT')
|
|
StartDTM = IConv(Get_Property(@Window : '.EDL_FROM','TEXT'),'DT4/HS')
|
|
StopDTM = IConv(Get_Property(@Window : '.EDL_TO','TEXT'),'DT4/HS')
|
|
If SavePath NE '' then
|
|
If SavePath[Len(SavePath), 1] NE '\' then
|
|
SavePath = SavePath : '\'
|
|
end
|
|
Swap '/' with '\' in SavePath
|
|
If FileName NE '' then
|
|
Test_Run_Services('GenerateTWCSVReport', StartDTM, StopDTM, SavePath : FileName)
|
|
If Error_Services('NoError') then
|
|
Msg(@Window, 'File saved to ' : SavePath : FileName)
|
|
end else
|
|
Msg(@Window , Error_Services('GetMessage'))
|
|
end
|
|
end else
|
|
Msg(@Window, 'You must specify a file name to save as.')
|
|
end
|
|
end else
|
|
Msg(@Window, 'You must specify a location to save the file to.')
|
|
end
|
|
end event
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Internal GoSubs
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
InitializeForm:
|
|
PlaceDialog(-2, -2)
|
|
DefaultPath = Environment_Services('GetUserDesktopPath')
|
|
If DefaultPath NE '' then
|
|
Set_Property(@Window : '.EDL_SAVE_TO_PATH', 'TEXT', DefaultPath)
|
|
end
|
|
|
|
//Set file name to a default
|
|
Set_Property(@Window : '.EDL_FILE_NAME', 'TEXT', 'TWUsageReport.csv')
|
|
return
|
|
|
|
SetupOLEControls:
|
|
Ctrl = @Window : '.OLE_FROM_CAL'
|
|
Set_Property(Ctrl, 'OLE.Border', 'XP Flat')
|
|
Set_Property(Ctrl, 'OLE.Font', 'Segoe UI' : @SVM : '9')
|
|
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnSelChange', 1)
|
|
|
|
Ctrl = @Window : '.OLE_TO_CAL'
|
|
Set_Property(Ctrl, 'OLE.Border', 'XP Flat')
|
|
Set_Property(Ctrl, 'OLE.Font', 'Segoe UI' : @SVM : '9')
|
|
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnSelChange', 1)
|
|
return
|
|
|
|
|
|
|