Recent

Author Topic: Text disappears when cursor enters TDBEdit  (Read 4757 times)

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Text disappears when cursor enters TDBEdit
« on: April 27, 2017, 10:38:22 pm »
On one of my forms when the the cursors enters the TDBEdit the contents disappears.  When the cursor is placed on another control the contents reappears.  Othe TDBEdits on my other forms does not display this behaviour.  Any suggestions on how to stop this from happening?
Lazarus 1.8.0Rc4, Windows 10

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: Text disappears when cursor enters TDBEdit
« Reply #1 on: April 28, 2017, 05:52:54 am »
Please show us your code (even better include the form). Bugs can happen anywhere, without inspecting your code no much we can say.

If you think the bug is not in your code, then you can try to start a new project add a TDBEdit, some other controls and link them properly. If that issue doesn't happen, that means you did something wrong in your old project.

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Re: Text disappears when cursor enters TDBEdit
« Reply #2 on: April 28, 2017, 09:02:20 am »
Can be a refresh problem?

I have one form with some TDBEdit and also some times disappears (also with tdbmemo) so temporaly i have placed a button with form1.refresh.

Also some times the rectangle about tdbedit change background color and line width. With refresh all return to normal view.

Regards.
« Last Edit: April 28, 2017, 09:05:08 am by jma_sp »
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Re: Text disappears when cursor enters TDBEdit
« Reply #3 on: April 30, 2017, 12:59:07 am »
jma_sp, I have tried refreshing but that doesn't work.  I've attached a project to demonstrate the problem.

When you click the "Edit Todo" button a second form will open.  Place the cursor in the "Task" edit box and the content disappears.

The second form is has two Tpanels.  One Tpanel have the controls to enter/update comments and the other panel the controls to enter/update a todo item.  The database is Firebird 2.5 however I've also included the script so the tables can be recreated in another database.
Lazarus 1.8.0Rc4, Windows 10

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: Text disappears when cursor enters TDBEdit
« Reply #4 on: April 30, 2017, 06:35:17 am »
I've tried your code, but I can't make it work.

On the first time trying your code, I got this error: "Missing Packages: laz_fpspreadsheet_visual". It solved easily by removing that item on the required packages, without having any bad impact with your code.

Then the code showed an exception that telling me it requires Firebird 2.5. Solved, by installing Firebird and libfbembed2.5.

The code should now be able to run, but a new exception raised:

Quote
Project Manageit raised exception class 'EIBDatabaseError' with message:
conGov : DoInternalConnect :
-Unable to complete network request to host "C".
-Failed to locate host machine.

I noticed your TIBConnection.conGov has a hardcoded string "C:\Users\G\Documents\problem\Db\TEST.FDB". I changed it to the correct location on my computer, I'm using Linux. I made a bit progress, but a new kind of exception showed up:

Quote
Project Manageit raised exception class 'EIBDatabaseError' with message:
conGov : DoInternalConnect :
-cannot attach to password database

Now, I do not know what can I do. You should make your program/database easier to deploy on other machines. I think your issue is not simply LCL: TDBEdit problem, it is Firebird database related, and you may tried to post it (or change it) under database sub forum, then you will get more database experts to help.

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Re: Text disappears when cursor enters TDBEdit
« Reply #5 on: April 30, 2017, 08:35:24 am »
Have you tried placing directly tdbedit in the form instead of under other component? i have to try the difference. The last time i used it was ever under tpanel and may be that under some components the content not ever refresh correctly.
I suppouse your application is connecting propertly to your DDBB, you can also use a sqlite3 connection if the application is simple to make it more easy to test for others.
I dont have a computer this days to try the program, sorry.

Saludos.
« Last Edit: April 30, 2017, 08:42:33 am by jma_sp »
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Re: Text disappears when cursor enters TDBEdit
« Reply #6 on: May 01, 2017, 10:13:13 am »
Sorry, I thought I had removed all the unnecessary dependencies.  I've changed the file so that the program picks up the db.  I've attached an updated version to make it easier to deploy.  In the mainmod file I've set the username and password for the database, which is the default 'Sysdba' and 'masterkey'.  I haven't used Firebird on Linux so I'm not familiar with setting it up on that environment.

The TDBEdit still has the same behaviour if placed on the form itself instead of on the Tpanel.  I've included the code below that should recreate the table for MYSQL db.

Code: Pascal  [Select][+][-]
  1. CREATE TABLE GDLCOMMENT
  2. (
  3.   COMID                  INT         NOT NULL,
  4.   ACOMMENT               BLOB,
  5.   COMDATE                  DATE         NOT NULL,
  6.   GDLID                  INT         NOT NULL,
  7.   PRIMARY KEY (COMID)
  8. );
  9.  
  10. CREATE TABLE TODOLIST
  11. (
  12.   TDLID                      INT         NOT NULL,
  13.   TASK                       VARCHAR(255) NOT NULL,
  14.   TDLDETAIL                  BLOB,
  15.   DATECREATE                 DATE         NOT NULL,
  16.   DATEDUE                    DATE         NOT NULL,
  17.   DATECOMPLETE               DATE,
  18.   GDLID                      INT         NOT NULL,
  19.   COMPLETED                  INT,
  20.  PRIMARY KEY (TDLID)
  21. );
  22.  
  23.  
  24. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (1, 'First Task', 'First task', '2017/03/23', '2017/03/25', NULL, 1, 1);
  25. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (2, 'This is it', 'This is it', '2017/03/23', '2017/03/23', NULL, 1, 1);
  26. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (3, 'Second Task', 'This is the second todo I''ve entered via the programme.', '2017/03/23', '2017/03/28', NULL, 1, 0);
  27. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (5, 'Not to be', 'this should not be at the top', '2017/03/20', '2017/03/16', NULL, 1, 1);
  28. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (6, 'My best', 'who knows', '2017/03/23', '2017/05/25', '2017/04/30', 3, 1);
  29. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (20, 'test', NULL, '2017/04/24', '2017/04/18', NULL, 5, 0);
  30. INSERT INTO TODOLIST (TDLID, TASK, TDLDETAIL, DATECREATE, DATEDUE, DATECOMPLETE, GDLID, COMPLETED) VALUES (21, 'test 2', NULL, '2017/04/24', '2017/05/02', NULL, 5, 0);
  31.  
  32. INSERT INTO GDLCOMMENT (COMID, ACOMMENT, COMDATE, GDLID) VALUES (1, 'My first comment.  I made a change to it', '2017/03/21', 1);
  33.  
  34.  
Lazarus 1.8.0Rc4, Windows 10

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Re: Text disappears when cursor enters TDBEdit
« Reply #7 on: May 03, 2017, 11:00:43 pm »
The problem seemed to have been a routine I was using on the main form to display the contents of memo fields in the main forms TDBGrids.  (This is a routine that was posted by anyeos ).  As I didn't need it on the Todo list TDBGrid I removed it and the control on TDBEdit on the second form started to behave normally.
Lazarus 1.8.0Rc4, Windows 10

 

TinyPortal © 2005-2018