Use Dfpanel.pkg Register_Function isFileViewWindow Integer hoID Returns Integer Class cHammerPanel is a Panel Procedure Construct_Object Forward Send Construct_Object // Property Boolean pbStartingUp False // Set to true when the hammer is starting, set to false after last file is opened. Property Boolean pbShuttingDown False // Set to true when the hammer is closed Property Boolean pbWorkspaceChanging False // Set to true when the hammer changes workspaces Property Integer phoDependencyScanner 0 Property Boolean pbCaptionUpdateState True // Set pbSizeToClientArea to False // End_Procedure // Construct_Object Procedure UpdateCaption String sFile String sPanelLabel If (not(pbCaptionUpdateState(Self))) Procedure_Return Get CreateProgramLabel to sPanelLabel If (sFile<>"") Begin Move (sPanelLabel * '[' +sFile+ ']') to sPanelLabel End Set Label to sPanelLabel End_Procedure // // extract the filename from the program application label so we can identify the // view that is current but does not have the focus // Function FileNameFromProgramLabel Returns String String sLabel String sRemove String sFileName Get Label To sLabel // filename of current file is in the captionbar Move (Left(sLabel,Pos("[",sLabel))) To sRemove Move (Replace(sRemove,sLabel,"")) To sFileName Move (Replace("*",sFileName,"")) To sFileName Move (Replace("]",sFilename,"")) To sFileName Function_Return (trim(sFilename)) End_Function // // If the focus is on a toolpanel of any kind and you use a shortcut or toolbar button then the // GetEditViewID function will bubble up to the panel and we need to find what view is current. // Function GetEditViewID Returns Handle Handle hoClientID Handle hoVw String sFileName Move 0 To hoVw Get Client_ID to hoClientID If (hoClientID) Begin Get FileNameFromProgramLabel to sFilename If (sFileName<>"") Begin Get FindViewByFileName Of hoClientID sFileName To hoVw End End Function_Return hoVw End_Function // Alt-F4, X-button Procedure Exit_Application Handle hScope hClientID Set pbShuttingDown to True Get Client_Id to hClientID Get Current_Scope of Desktop to hScope If (isFileViewWindow(hClientID, hScope)) Begin Set psLastEditedFile of ghoEditorProperties to (psFileName(hScope)) End // Forward Send Exit_Application End_Procedure // Exit_Application // A close_panel request has been sent. // This will quit the application, but the exit_application message is never // sent. Procedure Close_Panel Set pbShuttingDown to True Forward Send Close_Panel End_Procedure // Close_Panel End_Class // cHammerPanel