Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-09

TDBF File is NOT created!!! FieldDefs.add( field, param, param ) does NOT create fields.

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter E Williams

SOLVED !!!

Show quoted text 24 lines
On 9/1/2010 08:45, Peter E Williams wrote: > Hi all, > > This one is really puzzling. I thought that I was doing everything okay > to generate a new TDBF file... but I cannot create the file. The > following is tracetestUnit1.pas which is a test unit to create a dBase > format TDbf database file. > > Output to memo1 follows: > > FilePath > = /home/pewink/Public/My_code/Lazarus_source/pewink/Hexxpawn/lazarus/0.5.alpha/ > TableName = hex8_log.dbf > Trace File does not exist. > closing Trace file. ummm.... the file doesn't exist yet you close it anyway without it having been opened? > Starting to add fields with .FieldDefs > finished adding fields. > closing trace file. > Opening Trace File. > Exception opening trace file.

After to procedure changes (see below). First time procedure is called (file does not exist):

FilePath = /home/pewink/Public/My_code/Lazarus_source/pewink/Hexxpawn/lazarus/0.5.alpha/ TableName = hex8_log.dbf
Starting to add fields with .FieldDefs
finished adding fields.
2.closing trace file.
Opening Trace File.
FindLast record.
3.closing trace file.

2nd time, file exists.

FilePath = /home/pewink/Public/My_code/Lazarus_source/pewink/Hexxpawn/lazarus/0.5.alpha/ TableName = hex8_log.dbf
Opening Trace File.
FindLast record.
3.closing trace file.

procedure TForm1.open_trace_file;
var
  S : String;
  I : integer;
begin
  S := Application.ExeName;
  // hack for Mac
  I := Pos('.app/Contents/MacOS/', S);
  if (I > 0) then
    S := Copy(S,1, I+3);
  try
    begin
      Trace_File_DBF := TDbf.Create(nil);
      Trace_File_DBF.TableLevel := Longint(TXBaseConst);
      Trace_File_DBF.FilePath := ExtractFilePath(S);
      Trace_File_DBF.TableName := filename_Trace_File_DBF;
      memo1.lines.add( 'FilePath = ' + Trace_File_DBF.FilePath );
      memo1.lines.add( 'TableName = ' + Trace_File_DBF.TableName );
      Trace_File_DBF.TableLevel := Longint(TXBaseConst);
      if not FileExists( filename_Trace_File_DBF ) then
      begin
           With Trace_File_DBF do
           begin
           	TableLevel := Longint(TXBaseConst);
           	FilePath := ExtractFilePath(S);
           	with Trace_File_DBF.FieldDefs do
                begin
                     memo1.lines.add( 'Starting to add fields with .FieldDefs' );
                     // Trace_File_DBF.FilePathFull := ????????
                     with Trace_File_DBF.FieldDefs do
                          begin
                               Add( 'game_count', ftinteger, 0, True );
[... etc more Add fields here ]
                          end; // with
                     memo1.lines.add( 'finished adding fields.' );
                end; // with
                showmessage( 'Creating Table: Trace File.' );
                Trace_File_DBF.CreateTable;
                memo1.lines.add( '2.closing trace file.' );
                Trace_File_DBF.Close;
           end; // with
      end; // then
      memo1.lines.add( 'Opening Trace File.' );
      Trace_File_DBF.Exclusive := true;
      Trace_File_DBF.Open;
      Trace_File_DBF_open := true;
      memo1.lines.add( 'FindLast record.' );
      Trace_File_DBF.FindLast;
    end; // try
  except
      memo1.lines.add( 'Exception opening trace file.' );
  end;
end; { open_trace_file }
Proudly developing Quality Cross Platform Open Source Games Since 1970 with a Commodore PET 4016 with 16 KRAM http://pews-freeware-games.org (<--- brand new)

Reply by email

Benito van der Zander

Hi,
What exactly happens with the parent parent control of an TEdit if you change the background color of the edit on gtk2? It seems to directly invalidate the painting area of the parent parent control
without sending lm_erasebkgnd or calling invalidate.

My detailed problem is the following:
I'm using my own tree list view, which is like a completely custom drawn list view, and its drawing is a little bit slow, around 10 ms. Therefore I also use my own painting system, which catches all incoming painting/inputs events, and only executes them when the message queue is empty
or 20 ms have passed. It also uses a custom double buffer, and ignores any background cleaning events.
This works fine with all events handled directly from my control. BUT there is also a TEdit on a panel in the treelistview (like a search bar), and
when the user writes something there, the edit can change its background color.
And as soon as the color changes, the whole area of my treelistview gets gray,
and only after a few milliseconds the correct content is painted, causing an annoying flickering.
Furthermore, this only happens in the recent Lazarus/gtk version, it worked fine with an old Lazarus or in Delphi.

I found a workaround to cache also the edit color change, and then only change the
edit color in the paint event of my treelistview, directly before the double buffer is displayed.
And although you won't notice the flickering with this anymore, it doesn't solve the real problem,
that the tedit is clearing the content of my control.

Benito van der Zander

Reply by email