Ignore:
Timestamp:
Aug 14, 2024, 1:05:13 PM (3 months ago)
Author:
chronos
Message:
  • Added: Full screen switching support.
  • Added: Help form.
  • Modified: Updated Common package.
  • Fixed: Execution of compiled Java and C# programs.
  • Fixed: Removed interlanced empty lines in Console form on Unix.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/PersistentForm.pas

    r145 r153  
    1616    FMinVisiblePart: Integer;
    1717    FRegistryContext: TRegistryContext;
     18    FResizeEventOccured: Boolean;
    1819    procedure LoadControl(Control: TControl);
    1920    procedure SaveControl(Control: TControl);
     21    procedure WindowStateChange(Sender: TObject);
    2022  public
    2123    FormRestoredSize: TRect;
     
    301303
    302304procedure TPersistentForm.SetFullScreen(State: Boolean);
     305{$IFDEF UNIX}
     306var
     307  OldHandler: TNotifyEvent;
     308var
     309  I: Integer;
     310{$ENDIF}
    303311begin
    304312  if State then begin
     
    312320    end;
    313321    FormWindowState := Form.WindowState;
    314     Form.WindowState := wsMaximized;
    315     Form.WindowState := wsNormal;
    316     ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);
    317322    {$IFDEF WINDOWS}
    318323    Form.BorderStyle := bsNone;
    319324    {$ENDIF}
     325    Form.WindowState := wsFullscreen;
     326    {$IFDEF UNIX}
     327    // Workaround on Linux, WindowState is rewriten by WMSize event to wsNormal.
     328    // We need for that even to occure
     329    OldHandler := Form.OnWindowStateChange;
     330    Form.OnWindowStateChange := WindowStateChange;
     331    FResizeEventOccured := False;
     332    for I := 0 to 10 do begin
     333      if FResizeEventOccured then Break;
     334      Application.ProcessMessages;
     335      Sleep(1);
     336    end;
     337    Form.OnWindowStateChange := OldHandler;
     338    FormFullScreen := True;
     339    {$ENDIF}
    320340  end else begin
    321341    FormFullScreen := False;
     342    Form.WindowState := wsNormal;
    322343    {$IFDEF WINDOWS}
    323344    Form.BorderStyle := bsSizeable;
    324345    {$ENDIF}
    325     ShowWindow(Form.Handle, SW_SHOWNORMAL);
    326346    if FormWindowState = wsNormal then begin
    327347      Form.WindowState := wsNormal;
     
    335355end;
    336356
     357procedure TPersistentForm.WindowStateChange(Sender: TObject);
     358begin
     359  Form.WindowState := wsFullscreen;
     360  FResizeEventOccured := True;
     361end;
     362
    337363end.
Note: See TracChangeset for help on using the changeset viewer.