Changeset 12 for trunk/UFormMain.pas


Ignore:
Timestamp:
Apr 28, 2016, 5:35:05 PM (9 years ago)
Author:
chronos
Message:
  • Added: Configurable main form stay on top feature.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r10 r12  
    8787    procedure TrayIcon1Click(Sender: TObject);
    8888  private
     89    FAlwaysOnTop: Boolean;
     90    procedure SetAlwaysOnTop(AValue: Boolean);
     91  private
    8992    FoundAcronyms: TAcronymMeanings;
    9093    RegistryContext: TRegistryContext;
     
    9699  public
    97100    AcronymDb: TAcronymDb;
     101    property AlwaysOnTop: Boolean read FAlwaysOnTop write SetAlwaysOnTop;
    98102  end;
    99103
     
    300304procedure TFormMain.ASettingsExecute(Sender: TObject);
    301305begin
    302   FormSettings.ShowModal;
     306  FormSettings.Load;
     307  if FormSettings.ShowModal = mrOk then
     308    FormSettings.Save;
    303309end;
    304310
     
    368374end;
    369375
     376procedure TFormMain.SetAlwaysOnTop(AValue: Boolean);
     377begin
     378  if FAlwaysOnTop = AValue then Exit;
     379  FAlwaysOnTop := AValue;
     380  if FAlwaysOnTop then FormStyle := fsSystemStayOnTop
     381    else FormStyle := fsNormal;
     382end;
     383
    370384procedure TFormMain.OpenRecentClick(Sender: TObject);
    371385begin
     
    422436      CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
    423437      else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
     438    AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False);
    424439  finally
    425440    Free;
     
    438453      WriteString('LanguageCode', CoolTranslator1.Language.Code)
    439454      else DeleteValue('LanguageCode');
     455    WriteBool('AlwaysOnTop', AlwaysOnTop);
    440456  finally
    441457    Free;
Note: See TracChangeset for help on using the changeset viewer.