Recent

Author Topic: Help in the following error: External SIGSEGV  (Read 4843 times)

andrejsilva

  • New Member
  • *
  • Posts: 14
Help in the following error: External SIGSEGV
« on: July 21, 2009, 03:13:48 am »
Whenever I try to list the printers the Lazarus returns this error. This is my code: if Printer.Printers.Count > 0 then
     begin
          frmAJSelPrinter := TfrmAJSelPrinter.Create(nil);
          try
             This error happens here. Q At the time the printer will return
             frmAJSelPrinter.lstimpressoras.Items := Printer.Printers;
                         
frmAJSelPrinter.lstimpressoras.ItemIndex:=0;
             frmAJSelPrinter.ShowModal;
             Imp := frmAJSelPrinter.lstimpressoras.Items[
                  frmAJSelPrinter.lstimpressoras.ItemIndex];
             Printer.PrinterIndex:=frmAJSelPrinter.lstimpressoras.ItemIndex;
             //Printer.SetPrinter(imp);
             PrinterName := imp;
             Printer.Copies := frmAJSelPrinter.spincopias.Value;
          finally
             frmAJSelPrinter.Free;
          end;
      end else begin
          MessageDlg('Atenção', 'Nenhuma impressora esta instalada.',
           mtWarning, [mbOK, mbCancel], 0);
      end;         

 8)
 

arnoldb

  • Jr. Member
  • **
  • Posts: 96
Re: Help in the following error: External SIGSEGV
« Reply #1 on: July 28, 2009, 11:12:59 am »
Is frmAJSelPrinter.lstimpressoras a TListbox?
Then try frmAJSelPrinter.lstimpressoras.items.assign(printer.printers).

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: Help in the following error: External SIGSEGV
« Reply #2 on: July 28, 2009, 01:41:23 pm »
If you want this is a easy way for select printers.

Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
begin
  if not PrintDialog1.Execute then exit;
  ShowMessage('Number selected printer: '+IntToStr(Printer.PrinterIndex));
end;