Forum > Packages and Libraries

Form Close don't close form

(1/1)

eldonfsr:
Hi I have this problem and i don't understand what is wrong from main form a call a new form but when click on close button don't close still active

this code called to other form

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFormMain.ToolButton2Click(Sender: TObject);begin  if not Assigned(FormOpenCia) then begin     Application.CreateForm(TFormOpenCia, FormOpenCia );  end;  FormOpenCia.ShowModal;end;      
and this code form

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit fopencia; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, db, sqldb, Forms, Controls, Graphics, Dialogs, DBGrids,  Buttons, DateUtils;  function updatebalance():boolean;type   { TFormOpenCia }   TFormOpenCia = class(TForm)    BtnOk: TBitBtn;    BtnClose: TBitBtn;    DBGCias: TDBGrid;    DSCias: TDataSource;    SQLQCias: TSQLQuery;    SQLQCiasCKBIT: TWideStringField;    SQLQCiasCOMPLETE: TLongintField;    SQLQCiasDEFHRS: TBCDField;    SQLQCiasDPOLICY: TLongintField;    SQLQCiasEROLL: TWideStringField;    SQLQCiasFCADD1: TWideStringField;    SQLQCiasFCADD2: TWideStringField;    SQLQCiasFCCITY: TWideStringField;    SQLQCiasFCKEY: TLongintField;    SQLQCiasFCNAME: TWideStringField;    SQLQCiasFCOTHER: TWideStringField;    SQLQCiasFCSTATE: TWideStringField;    SQLQCiasFCZIPCODE: TWideStringField;    SQLQCiasLP_EDATE: TDateField;    SQLQCiasLP_SDATE: TDateField;    procedure BtnOkClick(Sender: TObject);    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);    procedure FormShow(Sender: TObject);  private   public   end; var  FormOpenCia: TFormOpenCia; implementation uses Fmain;{$R *.lfm} { TFormOpenCia } procedure TFormOpenCia.BtnOkClick(Sender: TObject); begin   FormMain.Caption := 'Company :'+SQLQCias.FieldByName('fcname').AsString;  FormMain.idcia:= SQLQCias.FieldByName('fckey').AsString ;  FormMain.namecia:= SQLQCias.FieldByName('fcname').AsString;  FormMain.Hrs:= SQLQCias.FieldByName('defhrs').AsInteger ;  FormMain.Policy:= SQLQCias.FieldByName('dpolicy').AsInteger ;  FormMain.SQLQFold.ParamByName('pidcia').AsString:= FormMain.idcia;  FormMain.StartPeriod:= SQLQCias.FieldByName('lp_sdate').AsDateTime;  FormMain.EndPeriod:= SQLQCias.FieldByName('lp_edate').AsDateTime;  FormMain.StatusBar1.Panels[0].Text:='Working Period From :'+FormatDateTime('mm-dd-yyyy',FormMain.StartPeriod) +' End Period :'+FormatDateTime('mm-dd-yyyy',FormMain.EndPeriod) ;  FormMain.SQLQFold.Open;  FormMain.SQLQFold.First;   FormMain.SQLQVacd.ParamByName('folderkey').AsString:=FormMain.SQLQFold.FieldByName('folderkey').AsString  ;  if( monthof(FormMain.Calendarlite1.Date) < 10) then begin     FormMain.SQLQVacd.ParamByName('month').AsString:= '0'+ inttostr( monthof(FormMain.Calendarlite1.Date)); ;  end else begin   FormMain.SQLQVacd.ParamByName('month').AsString   :=  inttostr( monthof(FormMain.Calendarlite1.Date));  end;  FormMain.SQLQVacd.ParamByName('pfc').AsString:=FormMain.idcia  ;  FormMain.SQLQVacd.Open;  if not FormMain.SQLQFold.EOF  then begin       FormMain.MenuMigrate.Enabled:=false;   end else begin       FormMain.MenuMigrate.Enabled:=true;   end;   if FormMain.EndPeriod < Date then begin      FormMain.MenuItem15.Enabled:=true;   end else begin      FormMain.MenuItem15.Enabled:=false;   end;    FormMain.MenuItemBkp.Enabled:=false;   FormMain.CalendarLite1MonthChange(FormMain.CalendarLite1);    FormMain.AutoPanel1.Visible:=true;   FormMain.TCFold.PageIndex:=0;   FormMain.TCFold.Tabs.Clear;   if( not FormMain.SQLQFold.eof) then begin     FormMain.RxDBGrid1.Refresh;     FormMain.TCFold.Tabs.Add(FormMain.SQLQFold.FieldByName('Lname').AsString +' '+FormMain.SQLQFold.FieldByName('mname').AsString+FormMain.SQLQFold.FieldByName('fname').AsString );     FormMain.CalcBalance();   end;   FormMain.ToolButton3.Enabled:=true;   FormMain.TBNewFld.Enabled:=true;   FormMain.TBFoldEdit.Enabled:=true;   FormMain.TBFoldDel.Enabled:=true;   FormMain.Btnnew.Enabled:=true;   FormMain.BtnEdit.Enabled:=true;   FormMain.BtnDel.Enabled:=true;    SQLQCias.Close;   FormMain.Refresh;   FormMain.RxDBGrid1.SetFocus;   FormOpenCia.Close;end; procedure TFormOpenCia.FormClose(Sender: TObject; var CloseAction: TCloseAction  );begin   CloseAction := CaFree;   SQLQCias.Close;   FormOpenCia:=nil;end; procedure TFormOpenCia.FormShow(Sender: TObject);begin  if SQLQCias.Active = false then begin     SQLQCias.Open;  end else begin     SQLQCias.Close;     SQLQCias.Open;  end;end; Function updatebalance():boolean;begin // FormMain.SQLQVacd.SQL.Text:='select * from lvlv where folderid=:fld and fc :=pidcia';  FormMain.SQLQVacd.ParamByName('folderkey').AsString:=FormMain.SQLQFold.FieldByName('folderkey').AsString  ;   FormMain.SQLQVacd.ParamByName('pfc').AsString:=FormMain.idcia  ;    if( monthof(FormMain.Calendarlite1.Date) < 10) then begin     FormMain.SQLQVacd.ParamByName('month').AsString:= '0'+ inttostr( monthof(FormMain.Calendarlite1.Date)); ;  end else begin   FormMain.SQLQVacd.ParamByName('month').AsString   :=  inttostr( monthof(FormMain.Calendarlite1.Date));  end;  FormMain.SQLQVacd.Open;  FormMain.AutoPanel1.Visible:=true;  FormMain.TCFold.PageIndex:=0;  FormMain.TCFold.Tabs.Clear;  FormMain.TCFold.Height:=FormMain.Height-70 ;  FormMain.TCFold.Width:=FormMain.Width-360 ;  FormMain.TCFold.Tabs.Add(FormMain.SQLQFold.FieldByName('Lname').AsString +' '+FormMain.SQLQFold.FieldByName('mname').AsString+FormMain.SQLQFold.FieldByName('fname').AsString );  FormMain.SQLQVacd.First;  FormMain.VacaUsd :=0;  FormMain.SicUsd :=0;  FormMain.admiusd:=0;  FormMain.compusd:=0;  FormMain.otherusd:=0;  FormMain.fmlausd:=0;  while not FormMain.SQLQVacd.EOF do begin     if (FormMain.SQLQVacd.FieldByName('lvdate').AsString <> '') then begin        if( MonthOf(StrToDate(FormMain.SQLQVacd.FieldByName('lvdate').AssTRING)) = Monthof( FormMain.CalendarLite1.Date)) then begin          FormMain.CalendarLite1.AddSelectedDate( StrToDate(FormMain.SQLQVacd.FieldByName('lvdate').AsString));        end;        if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='Vacation') then begin            FormMain.VacaUsd := FormMain.vacausd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;        if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='Sick') then begin            FormMain.SicUsd := FormMain.sicusd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;        if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='Administrative') then begin            FormMain.AdmiUsd := FormMain.admiusd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;        if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='UnAuthorized') then begin            FormMain.UnathUsd := FormMain.unathusd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;         if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='Compensation') then begin            FormMain.CompUsd := FormMain.compusd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;         if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='Other') then begin            FormMain.otherUsd := FormMain.otherusd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;         if( Trim(FormMain.SQLQVacd.FieldByName('type').AsString) ='FMLA') then begin            FormMain.fmlaUsd := FormMain.fmlausd+FormMain.SQLQVacd.FieldByName('hrs').AsInteger;        end;     end;     FormMain.SQLQVacd.Next;  end;   FormMain.VacEr.Text:= FormMain.SQLQFold.FieldByName('El_VACA').AsString;   FormMain.VacFw.Text:= FormMain.SQLQFold.FieldByName('FW_VACA').AsString;   FormMain.SickEr.Text:= FormMain.SQLQFold.FieldByName('El_SICK').AsString;   FormMain.sickFw.Text:= FormMain.SQLQFold.FieldByName('FW_SICK').AsString;   FormMain.adEr.Text:= FormMain.SQLQFold.FieldByName('EL_ADMIN').AsString;   FormMain.adFW.Text:= FormMain.SQLQFold.FieldByName('FW_ADMIN').AsString;   FormMain.unEr.Text:= FormMain.SQLQFold.FieldByName('EL_UNAUTH').AsString;   FormMain.unFW.Text:= FormMain.SQLQFold.FieldByName('FW_UNAUTH').AsString;   FormMain.ComEr.Text:= FormMain.SQLQFold.FieldByName('EL_COMP').AsString;   FormMain.ComFW.Text:= FormMain.SQLQFold.FieldByName('FW_COMP').AsString;   FormMain.othEr.Text:= FormMain.SQLQFold.FieldByName('EL_OTHER').AsString;   FormMain.othFW.Text:= FormMain.SQLQFold.FieldByName('FW_OTHER').AsString;   FormMain.fmlEr.Text:= FormMain.SQLQFold.FieldByName('EL_FMLA').AsString;   FormMain.fmlFW.Text:= FormMain.SQLQFold.FieldByName('FW_FMLA').AsString;    FormMain.VacUsd.Text:= InttoStr(FormMain.vacausd);   FormMain.SickUsd.Text:= InttoStr(FormMain.Sicusd);   FormMain.admusd.Text  := InttoStr(FormMain.admiusd);   FormMain.unusd.Text  := InttoStr(FormMain.unathusd);   FormMain.comusd.Text  := InttoStr(FormMain.compusd);   FormMain.othusd.Text  := InttoStr(FormMain.otherusd);   FormMain.FMLusd.Text  := InttoStr(FormMain.FMLAusd);    FormMain.VacBlc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_VACA').AsString)  - StrToInt(FormMain.VacUsd.Text));   FormMain.sickBlc.Text := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_SICK').AsString)  - StrToInt(FormMain.SickUsd.Text));   FormMain.adblc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_ADMIN').AsString) - StrToInt(FormMain.ADMUsd.Text));   FormMain.unblc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_UNAUTH').AsString) - StrToInt(FormMain.UnUsd.Text));   FormMain.comblc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_COMP').AsString) - StrToInt(FormMain.ComUsd.Text));   FormMain.othblc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_OTHER').AsString) - StrToInt(FormMain.OthUsd.Text));   FormMain.fmlblc.Text  := IntToStr(StrToInt(FormMain.SQLQFold.FieldByName('EL_FMLA').AsString) - StrToInt(FormMain.fmlUsd.Text));  end;end.   

Navigation

[0] Message Index

Go to full version