Changeset 293 for trunk/Settings.pas


Ignore:
Timestamp:
Mar 5, 2021, 1:36:47 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Apply settings from settings dialog only after Ok button click.
  • Fixed: Improved full screen mode switching. F11 key can be used in game client form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Settings.pas

    r259 r293  
    4242  public
    4343    Languages: TLanguages;
     44    procedure LoadData;
     45    procedure SaveData;
    4446  end;
    4547
     
    105107
    106108  ButtonFullscreen.Graphic := GrExt[HGrSystem].Data;
    107   if FullScreen then ButtonFullscreen.ButtonIndex := 3
    108     else ButtonFullscreen.ButtonIndex := 2;
    109109end;
    110110
     
    116116procedure TSettingsDlg.ButtonFullscreenClick(Sender: TObject);
    117117begin
    118   FullScreen := not FullScreen;
    119118  ButtonFullscreen.ButtonIndex := ButtonFullscreen.ButtonIndex xor 1;
    120119end;
     
    151150begin
    152151  Languages.LoadToStrings(List.Items);
    153   List.ItemIndex := Languages.Search(LocaleCode);
    154   if (List.ItemIndex = -1) and (Languages.Count > 0) then
    155     List.ItemIndex := 0;
    156152  List.Font.Color := MainTexture.clMark;
     153  LoadData;
    157154end;
    158155
    159156procedure TSettingsDlg.OKBtnClick(Sender: TObject);
    160157begin
     158  SaveData;
     159  ModalResult := mrOk;
     160end;
     161
     162procedure TSettingsDlg.LoadData;
     163begin
     164  List.ItemIndex := Languages.Search(LocaleCode);
     165  if (List.ItemIndex = -1) and (Languages.Count > 0) then
     166    List.ItemIndex := 0;
     167  if FullScreen then ButtonFullscreen.ButtonIndex := 3
     168    else ButtonFullscreen.ButtonIndex := 2;
     169end;
     170
     171procedure TSettingsDlg.SaveData;
     172begin
    161173  LocaleCode := Languages[List.ItemIndex].ShortName;
    162   ModalResult := mrOk;
     174  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
    163175end;
    164176
Note: See TracChangeset for help on using the changeset viewer.