Changeset 83 for trunk/Forms


Ignore:
Timestamp:
Aug 8, 2016, 10:25:19 AM (8 years ago)
Author:
chronos
Message:
  • Fixed: Starting minimalized in system tray.
  • Fixed: Clear filtered acronym list correctly after project is closed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r82 r83  
    120120    procedure TrayIcon1Click(Sender: TObject);
    121121  private
    122     Initialized: Boolean;
     122    InitializeStarted: Boolean;
     123    InitializeFinished: Boolean;
    123124    FAlwaysOnTop: Boolean;
    124125    RegistryContext: TRegistryContext;
     
    179180begin
    180181  AcronymDb := TAcronymDb.Create;
    181   Initialized := False;
     182  InitializeStarted := False;
     183  InitializeFinished := False;
    182184  for I := 0 to ToolBar1.ButtonCount - 1 do
    183185    ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption;
     
    191193procedure TFormMain.FormHide(Sender: TObject);
    192194begin
    193   PersistentForm1.Save(Self);
     195  if InitializeFinished then PersistentForm1.Save(Self);
    194196end;
    195197
     
    382384  Initialize;
    383385
    384   PersistentForm1.Load(Self);
    385   UpdateInterface;
    386   ListViewFilter1.StringGrid.Col := 1;
    387   ListViewFilter1.StringGrid.Col := 0;
    388   ListViewFilter1.StringGrid.Row := 0;
    389   ListViewFilter1.StringGrid.SetFocus;
     386  if Visible then begin
     387    PersistentForm1.Load(Self);
     388    UpdateInterface;
     389    ListViewFilter1.StringGrid.Col := 1;
     390    ListViewFilter1.StringGrid.Col := 0;
     391    ListViewFilter1.StringGrid.Row := 0;
     392    ListViewFilter1.StringGrid.SetFocus;
     393  end;
    390394end;
    391395
     
    487491  FileNameOption: string;
    488492begin
    489   if not Initialized then begin
    490     Initialized := True;
     493  if not InitializeStarted then begin
     494    InitializeStarted := True;
    491495    LoadConfig;
    492496
     
    526530    UpdateAcronymsList;
    527531    ListViewFilter1.UpdateFromListView(ListViewAcronyms);
     532    InitializeFinished := True;
    528533  end;
    529534end;
     
    604609  if Assigned(AcronymDb) then begin
    605610    ListViewSort1.Refresh;
    606   end else ListViewSort1.List.Clear;
     611  end else begin
     612    ListViewSort1.List.Clear;
     613    ListViewAcronyms.Items.Count := 0;
     614    ListViewAcronyms.Refresh;
     615  end;
    607616end;
    608617
     
    694703    OpenKey(RegistryRunKey, True);
    695704    if StartOnLogon then begin
    696       if StartMinimizedToTray then WriteString('Acronym Decoder', Application.ExeName + ' /t')
     705      if StartMinimizedToTray then WriteString('Acronym Decoder', Application.ExeName + ' ' + Application.OptionChar + 't')
    697706        else WriteString('Acronym Decoder', Application.ExeName)
    698707    end else DeleteValue('Acronym Decoder');
Note: See TracChangeset for help on using the changeset viewer.