Changeset 492


Ignore:
Timestamp:
Dec 28, 2023, 3:58:08 AM (20 months ago)
Author:
ataylor
Message:

Add system modal handling logic to TForm class and update NewView.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/MainForm.pas

    r489 r492  
    520520    Procedure DoFind( FindOrigin: TFindOrigin );
    521521
     522    // ALT 2023-12-24
     523    Procedure CheckSetSysModal(FormWindow: TForm);
     524    Procedure CheckUnsetSysModal;
     525
    522526    // Bookmarks ------------------------------------------
    523527
     
    37363740
    37373741  // [20231023 ALT] Restore any previous system-modal window state
     3742  {
    37383743  if g_LastSysModalWindow <> NULLHANDLE then
    37393744  begin
    37403745    WinSetSysModalWindow( HWND_DESKTOP, g_LastSysModalWindow );
    37413746  end;
     3747  }
     3748  CheckUnsetSysModal;
    37423749
    37433750  // TODO rbri maybe we have to do this
     
    43634370  StartingUp := false;
    43644371
    4365   // ALT 20231023 handle system modal owner
     4372  // [ALT 20231023] handle system modal owner
    43664373  g_LastSysModalWindow := WinQuerySysModalWindow( HWND_DESKTOP );
     4374  {
    43674375  if g_LastSysModalWindow <> NULLHANDLE then
    43684376  begin
    43694377    WinSetSysModalWindow( HWND_DESKTOP, Frame.Handle );
    43704378  end;
     4379  }
     4380  // [ALT 2023-12-26] move above to procedure
     4381  CheckSetSysModal(Self);
    43714382
    43724383  LogEvent(LogStartup, 'RUN PROGRAM');
     
    46904701    EndUpdate;
    46914702  end;
     4703//  CheckSetSysModal(InformationForm);
    46924704  InformationForm.ShowModal;
     4705//  CheckSetSysModal(Self);
    46934706End;
    46944707
     
    51525165  end;
    51535166
     5167  // [ALT 2023-12-26] Disable certain items when running sysmodal
     5168  if g_LastSysModalWindow <> NULLHANDLE then
     5169  begin
     5170    OpenMI.Enabled := false;
     5171    OpenSpecialMI.Enabled := false;
     5172    FileSaveAsMI.Enabled := false;
     5173    PrintMI.Enabled := false;
     5174//    FileInformationMI.Enabled := false;
     5175    SaveAsIPFMI.Enabled := false;
     5176    EditGlobalSearchMI.Enabled := false;
     5177    GlobalSearchMI.Enabled := false;
     5178    AddNoteMI.Enabled := false;
     5179    DebugSaveLanguageFileMI.Enabled := false;
     5180    DebugLoadLanguageMI.Enabled := false;
     5181
     5182    Coolbar.Sections[ ciOpen ].Disabled := true;
     5183    Coolbar.Sections[ ciPrint ].Disabled := true;
     5184    Coolbar.Sections[ ciAddNote ].Disabled := true;
     5185  end;
    51545186
    51555187end;
     
    62016233begin
    62026234  NoteSelected:= NotesListBox.ItemIndex <> -1;
    6203   EditNoteButton.Enabled:= NoteSelected;
    62046235  GotoNoteButton.Enabled:= NoteSelected;
    6205   DeleteNoteButton.Enabled:= NoteSelected;
    6206   AddNoteButton.Enabled := CurrentOpenFiles.Count > 0;
     6236  if g_LastSysModalWindow <> NULLHANDLE then
     6237  begin
     6238    AddNoteButton.Enabled := false;
     6239    EditNoteButton.Enabled := false;
     6240    DeleteNoteButton.Enabled := false;
     6241  end
     6242  else
     6243  begin
     6244    EditNoteButton.Enabled:= NoteSelected;
     6245    DeleteNoteButton.Enabled:= NoteSelected;
     6246    AddNoteButton.Enabled := CurrentOpenFiles.Count > 0;
     6247  end;
    62076248end;
    62086249
     
    71767217end;
    71777218
     7219
     7220Procedure TMainForm.CheckSetSysModal(FormWindow: TForm);
     7221begin
     7222  // Override any existing system-modal state
     7223  if g_LastSysModalWindow <> NULLHANDLE then
     7224  begin
     7225    WinSetSysModalWindow( HWND_DESKTOP, FormWindow.Frame.Handle );
     7226  end;
     7227end;
     7228
     7229
     7230Procedure TMainForm.CheckUnsetSysModal;
     7231begin
     7232  // Restore any previous system-modal window state
     7233  if g_LastSysModalWindow <> NULLHANDLE then
     7234  begin
     7235    WinSetSysModalWindow( HWND_DESKTOP, g_LastSysModalWindow );
     7236  end;
     7237end;
     7238
    71787239Initialization
    71797240  RegisterClasses ([TMainForm, TSplitBar,
  • trunk/NewView/VersionUnit.pas

    r488 r492  
    1717
    1818const
    19   Version =        'V2.19.8b';  // $SS_REQUIRE_NEW_VERSION$
    20   BldLevelVersion = '2.19.8b';  // Embedded for IBM BLDLEVEL tool
     19  Version =        'V2.19.8d';  // $SS_REQUIRE_NEW_VERSION$
     20  BldLevelVersion = '2.19.8d';  // Embedded for IBM BLDLEVEL tool
    2121  CopyrightMsg = 'Copyright 2005 Aaron Lawrence; 2006-2019 Ronald Brill';
    2222  LicenseMsg   = 'Licensed under the GNU Public License';
  • trunk/Sibyl/SPCC/FORMS.PAS

    r7 r492  
    77 º                                                                          º
    88 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ}
    9                              
     9
    1010Unit Forms;
    1111
     
    20572057         FOnCreate:TNotifyEvent;
    20582058         FOnDestroy:TNotifyEvent;
     2059         FSysModalWin:HWnd;      // [ALT 2023-12-27]
    20592060         Procedure CMRelease(Var Msg:TMessage); Message CM_RELEASE;
    20602061         Procedure CMEndModalState(Var Msg:TMessage); Message CM_ENDMODALSTATE;
     
    24642465// This is not functionally needed but prevents unnecessary GpiDeleteSetId calls
    24652466// which fail and therefore make it more difficult to test for real problems.
    2466 // Probably not safe to leave in due to incompatibility between components 
     2467// Probably not safe to leave in due to incompatibility between components
    24672468// and IDE  - AaronL
    24682469//         FFontSet:boolean;
     
    54165417          Begin
    54175418               FFont.Destroy;
    5418                FFont := nil; // AaronL - need to set ffont to nil 
     5419               FFont := nil; // AaronL - need to set ffont to nil
    54195420          End;
    54205421     End;
     
    62136214   CurrentModalFrame:HWND=0;
    62146215   DesktopHWND:HWND=0;
    6215    ModalList:TList=NIL;   
     6216   ModalList:TList=NIL;
    62166217
    62176218{$HINTS OFF}
     
    62746275Begin
    62756276     MyPID := GetCurrentProcessID;
    6276      
     6277
    62776278     // Get the count of switch list items
    62786279     SwitchListCount := WinQuerySwitchList( AppHandle, nil, 0 );
     
    62816282     // Allocate buffer
    62826283     GetMem( pSwitchListInfo, BufferSize );
    6283      
     6284
    62846285     // Call WinQuerySwitchList again to get the switch list items
    62856286     WinQuerySwitchList( AppHandle, pSwitchListInfo^, BufferSize );
    6286      
     6287
    62876288     for i := 0 to SwitchListCount - 1 do
    62886289     begin
     
    62936294                    // This switch entry is for this application
    62946295                    if swctl.hwnd = Exclude.FFrame.Handle then
    6295                          continue;                   
     6296                         continue;
    62966297                    // so show/hide it
    62976298                    if Show then
     
    63016302                    WinChangeSwitchEntry( hswitch,
    63026303                                          swctl );
    6303                                          
     6304
    63046305               end;
    63056306          end;
     
    79657966          If OnDismissDlg <> Nil Then OnDismissDlg(Self);
    79667967          If FModalResult <> cmNull Then EndModalState;
     7968
     7969          // [20231227 ALT] Restore any previous system-modal window
     7970          if FSysModalWin <> NULLHANDLE then
     7971              WinSetSysModalWindow( HWND_DESKTOP, FSysModalWin );
    79677972     End;
    79687973End;
     
    85088513     Show;
    85098514     BringToFront;
     8515
     8516     // [ALT 20231227]
     8517     FSysModalWin := WinQuerySysModalWindow( HWND_DESKTOP );
     8518     if FSysModalWin <> NULLHANDLE then
     8519          WinSetSysModalWindow( HWND_DESKTOP, Frame.Handle );
    85108520
    85118521again:
Note: See TracChangeset for help on using the changeset viewer.