Ignore:
Timestamp:
Mar 10, 2011, 11:20:08 AM (13 years ago)
Author:
george
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Demo/IDE/UMainForm.pas

    r184 r185  
    127127procedure TMainForm.ComboBox1Select(Sender: TObject);
    128128begin
    129   if ComboBox1.ItemIndex <> - 1 then
     129  if (ComboBox1.ItemIndex <> - 1) and (ComboBox1.ItemIndex < CoolDockLayoutList1.Items.Count) then
    130130    TCoolDockLayout(CoolDockLayoutList1.Items[ComboBox1.ItemIndex]).Restore;
    131131end;
     
    217217  NewLayout: TCoolDockLayout;
    218218begin
    219   if ComboBox1.Items.IndexOf(ComboBox1.Text) = -1 then begin
    220     NewLayout := TCoolDockLayout.Create;
    221     NewLayout.Name := ComboBox1.Text;
    222     NewLayout.Store;
    223     CoolDockLayoutList1.Items.Add(NewLayout);
    224   end else
    225     TCoolDockLayout(CoolDockLayoutList1.Items[ComboBox1.Items.IndexOf(ComboBox1.Text)]).Store;
    226   CoolDockLayoutList1.SaveToFile(DockLayoutFileName);
    227   CoolDockLayoutList1.PopulateStringList(ComboBox1.Items);
     219  if ComboBox1.Text <> '' then begin
     220    if ComboBox1.Items.IndexOf(ComboBox1.Text) = -1 then begin
     221      NewLayout := TCoolDockLayout.Create;
     222      NewLayout.Name := ComboBox1.Text;
     223      NewLayout.Store;
     224      CoolDockLayoutList1.Items.Add(NewLayout);
     225    end else
     226      TCoolDockLayout(CoolDockLayoutList1.Items[ComboBox1.Items.IndexOf(ComboBox1.Text)]).Store;
     227    CoolDockLayoutList1.SaveToFile(DockLayoutFileName);
     228    CoolDockLayoutList1.PopulateStringList(ComboBox1.Items);
     229  end else ShowMessage('Enter layout name');
    228230end;
    229231
Note: See TracChangeset for help on using the changeset viewer.