Recent

Author Topic: My application is greydout  (Read 3099 times)

jeanchristophe

  • Jr. Member
  • **
  • Posts: 88
My application is greydout
« on: August 22, 2014, 05:07:18 pm »
Hello

I have a little database application, where I have to edit some rows, choose a picture from a openpicture dialog and then save the filename in the database (sqlite)
My application gets grey, when I open the open picture dialog. when I close it, the form should get back to its own colour, but it stills get gray.
Can you please tell me, how I can avoid that?

Best Regards
Jean-Christophe

Eclipticon

  • Jr. Member
  • **
  • Posts: 51
Re: My application is greydout
« Reply #1 on: August 22, 2014, 05:33:28 pm »
Hi, could you post some details, like what operating system you are using, and the code you use to open this dialog?
Lazarus 1.2.4 on Win XP/7 Virtual Machine

jeanchristophe

  • Jr. Member
  • **
  • Posts: 88
Re: My application is greydout
« Reply #2 on: August 22, 2014, 05:56:49 pm »
Thank you for your answer  Eclipticon!

I run it on Mageia 4 (Linux - rpm based) i386
This is the last Lazarus version: 1.2.4
Here is the code:
Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
begin
  SQLite3Connection1.DatabaseName:= '/home/jean-christophe/Desktop/Lazarus/database/stamps.sqlite';
  If SQLite3Connection1.Connected= false then SQLite3Connection1.Connected:= true;
  SQLTransaction1.DataBase:= SQLite3Connection1;
  If SQLTransaction1.Active= false then SQLTransaction1.Active:=True;
  SQLQuery1.DataBase:= SQLite3Connection1;
  SQLQuery1.Transaction:= SQLTransaction1;
  SQLQuery1.PacketRecords:= -1;
  SQLQuery1.SQL.Add
  ('select * from yverttablefrim where Land = "France" and BilledetNogle is NULL order by Nummer asc;');
  If SQLQuery1.Active = false then SQLQuery1.Active:= true;
  DataSource1.DataSet:= SQLQuery1;

  If image1.Proportional = false then image1.Proportional := true;
  If image1.Center= false then image1.Center:= true;

end;

procedure TForm1.SQLQuery1AfterPost(DataSet: TDataSet);
begin
  SQLQuery1.ApplyUpdates;
  SQLTransaction1.CommitRetaining;
end;

procedure TForm1.B_CloseClick(Sender: TObject);
begin
  If SQLite3Connection1.Connected= true then SQLite3Connection1.Connected:= false;
  If SQLTransaction1.Active= true then SQLTransaction1.Active:= false;
  If SQLQuery1.Active = true then SQLQuery1.Active:= false;
  Application.Terminate;
end;

procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
  if not(DBGrid1.DataSource.DataSet.Fields[1].Value = NULL) then
  Image1.Picture.LoadFromFile(DBGrid1.DataSource.DataSet.Fields[1].Value)
  else
  Image1.Picture.Clear;
end;

procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TDBNavButtonType);
begin
  if not(DBGrid1.DataSource.DataSet.Fields[1].Value = NULL) then
  Image1.Picture.LoadFromFile(DBGrid1.DataSource.DataSet.Fields[1].Value)
  else
  Image1.Picture.Clear;
end;

procedure TForm1.B_Choose_FileClick(Sender: TObject);
var
  filename: String;
  begin
    if OpenPictureDialog1.Execute then
    begin
      filename := OpenPictureDialog1.Filename;
      Image1.Picture.LoadFromFile(filename);
      filename  := StringReplace(filename, '***/Lazarus', '..',[rfReplaceAll, rfIgnoreCase]);
      DBedit2.Text:= filename;
    end;
  end;
end.                       

Best Regards
Jean-Christophe
« Last Edit: August 22, 2014, 08:21:17 pm by jeanchristophe »

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: My application is greydout
« Reply #3 on: August 22, 2014, 08:01:29 pm »
may i ask the size of the image you are making your tests?
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

jeanchristophe

  • Jr. Member
  • **
  • Posts: 88
Re: My application is greydout
« Reply #4 on: August 22, 2014, 08:20:43 pm »
Thank you for your answer Never

The jpg is about 50k, about 500 x 300 pix.
One another thing is that I can't see the imagepreview in the OpenPictureDialog. Is it normal?

Best Regards
Jean-Christophe

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: My application is greydout
« Reply #5 on: August 22, 2014, 08:32:54 pm »
looks like your image for some reason is stuck on loading
a)check that your image component supports the loadding of your image type
http://wiki.freepascal.org/Developing_with_Graphics
b)try to double check your paths use full hardcode  paths at first ,
   be sure all is working fine and then proceed with automation also chek if in your paths are included not standar latin chars
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

jeanchristophe

  • Jr. Member
  • **
  • Posts: 88
Re: My application is greydout
« Reply #6 on: August 22, 2014, 09:39:08 pm »
I am going to try that Never.
But when I run one another little application I made, I can load the filename into an TImage component without problems.
It is just with the TOpenPictureDialog, I experience problems/challenges.
I didn't try on windows yet.

Best Regards
Jean-Christophe

 

TinyPortal © 2005-2018