* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Invalid Math Operations
« Last post by josh on Today at 08:30:15 am »
HI Lainz,

Could the issue be setting variables to mindouble; then calculating (sin/cos) based on such a small number could result in a zero result.. Setting your own MyMinDouble may help, that is not so small.

Code: [Select]
const mymindouble=mindouble;// you could try 0.000000000001;
var a:double=0;
    m:double=mymindouble;
    b:double=mymindouble;
    theta:double=mymindouble;
begin
  a:=sin(m * theta / 4) / b ;
  if a=0 then
  begin
    showmessage('equal to zero');
  end;
end;       
2
Spanish / Re: imprimir fotos desde lazReport
« Last post by GAN on Today at 06:37:38 am »
@jesusr

Con imágenes JPG no lanza ninguna excepción el depurador, pero con las PNG sí. Por lo que veo el problema es con el header. Adjunto capturas.

LazReport 0.9.9.

Saludos.
3
General / Re: Assign functions to dynamic objects
« Last post by torbente on Today at 06:04:12 am »
Quote
You create games too. You should participate the Game Contest 2018:

OffTopic: A game of life (https://bitstorm.org/gameoflife/) where the user can put permanent blocks, teletransport holes, multipliers... the posibilites are almost infinite. Sadly im now in 2 different projects.
4
General / Re: Assign functions to dynamic objects
« Last post by Handoko on Today at 05:45:47 am »
Hooray,  you got it. :D

Actually the compiler already told you what you did wrong. Unfortunately, not much people can't fully understand what it means:
Quote
Error: Incompatible types: got "<address of procedure(TObject;var Word;TShiftState);Register>" expected "<procedure variable type of procedure(TObject;var Word;TShiftState) of object;Register>"

i created several games using AGS

You create games too. You should participate the Game Contest 2018:
https://forum.lazarus.freepascal.org/index.php/topic,39495.0.html
5
Spanish / Re: imprimir fotos desde lazReport
« Last post by jesusr on Today at 05:45:32 am »
@GAN: ¿Qué excepciones? ¿Tienes algún backtrace que indique donde se originan?

@Bobito: ¿Qué versión de firebird usas? si es 2.x podrías hacer una bdd pequeña y con un programa ejemplo adjuntarlo a un bug report así podría darle un vistazo.
6
Hi,

I have been working through an unexpected behavior sometimes encountered when adding/ INSERT-ing a new record.

It appears to happen when the DBGrid Database cursor is on any other record than the first record showing in a DBGrid.

Attached is a working example project. The following explanation uses file: trial_0001.json

The use of the DBNavigator INSERT button causes a new record to be generated, and no matter where the database cursor is, it appears at the top, and initially as a full duplicate of the database's original first record.

If you attempt to enter (even first using the EDIT button to initiate) filling out the new record it disappears from view.

After first using the + INSERT button you have to immediately use the tick POST button, then you can successfully enter the record to add or edit information. At that point the (bogus) duplicate information from the first record disappears, and leaves you with pristine empty fields to use.

However, as you edit from left to right in the record's entry in the DBGrid, each previous field disappears as you enter the next.

Then  after you POST, all the new information/data re-appears correctly.

We can live with this procedure (immediately POST-ing a new record first before entering data)  - but I was thinking that it may flag other underlying problems, so thought to clear it all here first.

2. I open the JSON file(s) using:

  FDataset.Close;
   FDataset.LoadFromFile(filename);
  FDataset.Open;   

3. I found it was unwise to simply save to file responding to the  using the DataSource's OnDataChange event as you may end up with a stripped down skeletal JSON file during the transition of opening the next JSON file. Instead, manually in response to a button click I use:

   FDataset.SaveToFile(global_FileName, true);


I don't know if there is anything else I should be doing?


The following stream of images (attached as: images-for-forum.7z) illustrate the problem. And the image titles summarize the situation...

fpjsondataset-001-insert_record.jpg

fpjsondataset-002-duplicate_appearance_new_record.jpg

fpjsondataset-003-attempt_to_edit_new_record.jpg

fpjsondataset-004-have_to_POST_empty_new_record_before_adding_data_or_editing.jpg

fpjsondataset-005-while_adding_data_or_editing_field_info_temporarily_vanishes.jpg

fpjsondataset-006-after_POST_field_data_reappears.jpg

Any further advice would be appreciated please.

Lazarus 1.8.0 r56594 FPC 3.0.4 x86_64-win64-win32/win64

TIA

Paul
7
General / Re: Assign functions to dynamic objects
« Last post by torbente on Today at 05:34:50 am »
OMG! Yes, you are rigth, i did not declare the Tform1 (class) before the function name at the begining, but it was because originally the function was not declared in the same unit as form1 (neither the TEdit variable to be honest)
It will be nice some kind of document "good techniques to structure your program in FP using lazarus" or so; tips, common used sintaxys... etc etc

Once again, thank you very much.
(I just read your avatar; i created several games using AGS  8))
8
General / Re: Assign functions to dynamic objects
« Last post by Handoko on Today at 05:15:20 am »
I think you misunderstood the solution I gave you. See the code below:

Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLType;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     procedure Button1Click(Sender: TObject);
  17.     procedure OnCommandLineKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
  18.   end;
  19.  
  20. var
  21.   Form1: TForm1;
  22.   CommandLine: TEdit;
  23.  
  24. implementation
  25.  
  26. {$R *.lfm}
  27.  
  28. { TForm1 }
  29.  
  30. procedure TForm1.Button1Click(Sender: TObject);
  31. begin
  32.   CommandLine            := TEdit.Create(Self);
  33.   CommandLine.Parent     := Form1;
  34.   CommandLine.Left       := 50;
  35.   CommandLine.Top        := 30;
  36.   CommandLine.Height     := 12;
  37.   CommandLine.Width      := 200;
  38.   CommandLine.AutoSize   := True;
  39.   CommandLine.Color      := clBlack;
  40.   CommandLine.Font.Color := clWhite;
  41.   CommandLine.OnKeyUp    := @OnCommandLineKeyUp;
  42. end;
  43.  
  44. procedure TForm1.OnCommandLineKeyUp(Sender: TObject; var Key: Word;
  45.   Shift: TShiftState);
  46. begin
  47.   if Key=VK_RETURN then
  48.     ShowMessage('You''ve pressed Enter!');
  49. end;
  50.  
  51. end.

The code above also works. Your mistake wasn't on the line #22, but it is on the line #44.
9
General / Re: Assign functions to dynamic objects
« Last post by torbente on Today at 05:00:28 am »
Quote
Don't simply copy/paste my code because by you will learn nothing. You should compare yours with mine carefully so you can understand what you did wrong.

I declared Commandline as a var, not inside form1 class.
Good news, now i understand more about FP structure. Bad news, i will need recode all the other components i had as vars  %)

Thank you both so much
10
Spanish / Re: imprimir fotos desde lazReport
« Last post by GAN on Today at 04:59:14 am »
Yo me volví loco para imprimir imágenes con LazReport, al final lo conseguí pero no logré eliminar las excepciones cuando ejecuto el programa desde Lazarus. Si el programa lo ejecuto desde el sistema operativo funciona bien, sin errores.

Pregunta: ¿ejecutando el programa fuera del IDE, te produce algún error? ¿En LazReport utilizas "Insertar imagen"?
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus