shapes in my TDBTree have incorrect coordinates
shapes in my TDBTree have incorrect coordinates
I have a problem in my DBTree concerning node placement on the canvas when the tree loads. Some of the leaf nodes exhibit a strange behaviour where their canvas coordinates are set to the top of the tree. The nodes are always leaf nodes, and consistently the same nodes on each startup. They only exhibit this behaviour when hidden by an unexpanded parent node.
The erroneous nodes are hidden but capture onClickShape events that were meant for the root node (clicking root node after startup selects hidden node X instead of root node as expected. Expanding X's parent shows X as selected in the tree and updates X's coordinates to the node's correct position).
I load the tree from a database table specifying parent and text fields, and using an integer as primary key on the table.
I am fairly new to working with TeeTree; is there a checklist for ensuring the tree is correctly loaded and initialized?
I work in Delphi XE using TeeTree2
The erroneous nodes are hidden but capture onClickShape events that were meant for the root node (clicking root node after startup selects hidden node X instead of root node as expected. Expanding X's parent shows X as selected in the tree and updates X's coordinates to the node's correct position).
I load the tree from a database table specifying parent and text fields, and using an integer as primary key on the table.
I am fairly new to working with TeeTree; is there a checklist for ensuring the tree is correctly loaded and initialized?
I work in Delphi XE using TeeTree2
Re: shapes in my TDBTree have incorrect coordinates
Hello,
I'd suggest you to take a look at the TeeTree demo here:
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.
I'd suggest you to take a look at the TeeTree demo here:
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
Hey there. I have succeeded in isolating the problem to a small example project.
It appears to happen if the Expanded property is set True on a child of an unexpanded note
How can I send you the sample project?
It appears to happen if the Expanded property is set True on a child of an unexpanded note
How can I send you the sample project?
Re: shapes in my TDBTree have incorrect coordinates
Hello,
You can attach it in here in the forum.
As an alternative, you can also post your files at our upload page.
You can attach it in here in the forum.
As an alternative, you can also post your files at our upload page.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
I couldn't upload the file here, first it said maximum size 4MB exceeded. After fitting the project to this requirement it says maximum allowed size 512KB.. (You might want to have a look at that)
I've posted the files to your upload page by name bjarke moeholt, hopefully you can find them there.
In the project I've sent you, we use BDE database engine to establish a connection to and DBTree to visualize the contents of a database table. When setting the TTreeNodeShape.Expanded on nodes at level 1, we experience hidden shapes in unexpected places
I've posted the files to your upload page by name bjarke moeholt, hopefully you can find them there.
In the project I've sent you, we use BDE database engine to establish a connection to and DBTree to visualize the contents of a database table. When setting the TTreeNodeShape.Expanded on nodes at level 1, we experience hidden shapes in unexpected places
Re: shapes in my TDBTree have incorrect coordinates
Hello,
I'm not sure what could be the message you got at first. If you get it again, please take a screenshot of it.
Could you please simplify the application so we can reproduce the problem here?
The maximum file size allowed in these forums is 512KB.HGG_User wrote:I couldn't upload the file here, first it said maximum size 4MB exceeded. After fitting the project to this requirement it says maximum allowed size 512KB.. (You might want to have a look at that)
I'm not sure what could be the message you got at first. If you get it again, please take a screenshot of it.
I get an error when your application tries to Open the FQuery:HGG_User wrote:I've posted the files to your upload page by name bjarke moeholt, hopefully you can find them there.
In the project I've sent you, we use BDE database engine to establish a connection to and DBTree to visualize the contents of a database table. When setting the TTreeNodeShape.Expanded on nodes at level 1, we experience hidden shapes in unexpected places
So I'm not able to reproduce the problem here.Project SelectMapT.exe raised exception class EDBEngineError with message 'Unknown user name or password.
unavailable database
Alias: DB2350953'.
Could you please simplify the application so we can reproduce the problem here?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
Since the problem is related to a DBTree component, a database engine to establish a connection to the database is needed. What database engine are you using?
The project assumes BDE is installed. It is available for free at http://cc.embarcadero.com/item/27573
The project assumes BDE is installed. It is available for free at http://cc.embarcadero.com/item/27573
I've attached a screenshot to this post. Produced by attempting to upload a 5MB file:The maximum file size allowed in these forums is 512KB.
I'm not sure what could be the message you got at first. If you get it again, please take a screenshot of it.
Re: shapes in my TDBTree have incorrect coordinates
Hello,
Do you have access to a second machine to check if that test project runs on it?
From the initial post I understood the problem was on TeeTree behaviour once the data is loaded, not in the loading process. In that case, creating some shapes manually would be a simpler example, if still reproducing the problem.HGG_User wrote:Since the problem is related to a DBTree component, a database engine to establish a connection to the database is needed.
The project uses DB and DBTables. I'm trying it with RAD XE (that comes with BDE) and the project builds fine. However I get the mentioned error at runtime, when the Query tried to connect.HGG_User wrote:What database engine are you using?
The project assumes BDE is installed. It is available for free at http://cc.embarcadero.com/item/27573
Do you have access to a second machine to check if that test project runs on it?
Thanks for the screenshot. We'll check that.I've attached a screenshot to this post. Produced by attempting to upload a 5MB file:
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
ugh, this is turning into a database connectivity issue which is missing the point :/ We use Firebird 2.5 and BDE to connect to the database.The project uses DB and DBTables. I'm trying it with RAD XE (that comes with BDE) and the project builds fine. However I get the mentioned error at runtime, when the Query tried to connect.
Do you have access to a second machine to check if that test project runs on it?
In case you are still having issues connecting, could you change the example to do what you normally do to connect databases in your end? Our focus should remain on the contents of the table and not the access tools
Re: shapes in my TDBTree have incorrect coordinates
Hello,
I'm still finding problems with datasource you provided.
Could you please arrange a simple example project manually populating the tree?
I'm still finding problems with datasource you provided.
Could you please arrange a simple example project manually populating the tree?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
Ok, lets try again.. This time we're loading from xml, saving some space and working around database connectivity.
- Attachments
-
- TreeTest.zip
- (217.06 KiB) Downloaded 3081 times
Re: shapes in my TDBTree have incorrect coordinates
Hello,
I could run your project and I've seen a single node on the tree.
Deppending on where I click, the information below changes, but the tree isn't expanded:
I see you aren't assigning parents on the nodes.
Modifying your FormCreate to assign the parents according to the xml, I get this:
I could run your project and I've seen a single node on the tree.
Deppending on where I click, the information below changes, but the tree isn't expanded:
I see you aren't assigning parents on the nodes.
Modifying your FormCreate to assign the parents according to the xml, I get this:
Code: Select all
procedure TForm12.FormCreate(Sender: TObject);
var
NewShape : TTreeNodeShape;
ParentShape : TTreeNodeShape;
Workspace : Integer;
Parent : Integer;
begin
CDS.LoadFromFile( ExtractFilePath( Application.ExeName ) + 'Workspacetbl.xml' );
DBTree1.DataSet := CDS as Tdataset;
DBTree1.Refresh;
while not CDS.EOF do begin //Loop through the Query
Workspace:=CDS.FieldByName('Workspace').AsInteger;
//this is where we provoke the error: Expand all level 1 nodes and unexpand the rest.
NewShape:=FindNode(DBTree1,Workspace);
NewShape.Expanded := NewShape.Level=1;
Parent:=CDS.FieldByName('Parent').AsInteger;
ParentShape:=FindNode(DBTree1,Parent);
NewShape.Parent:=ParentShape;
CDS.Next;
end;
//MessageDlg('Error preparations completed: On our end, we have an invisible node overlapping the root node approx at the text field'
//+ ' click to verify this', mtInformation, [mbOk], 0);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
I'm glad you are able to reproduce our problem. As you can see, the richedit mirrors the node properties of the last clicked node. When that changes it is because the Sender node of the onClick-events varies depending on where you click, despite the fact that, according to the GUI, we are clicking the same (and only) displayed node each time. It follows that some nodes are misplaced in the tree in the current state.
Expanding the tree corrects the subnode placement so that we are able to select the root node correctly. I'd guess its the redraw that corrects the incorrect node positions.
Expanding the tree corrects the subnode placement so that we are able to select the root node correctly. I'd guess its the redraw that corrects the incorrect node positions.
You confuse me. We are assigning node parents design-time using the TDBTree ParentField property. Since the DBTree component should mirror the tree structure from a database table, I assume this is sufficient (it's not??)I see you aren't assigning parents on the nodes.
Modifying your FormCreate to assign the parents according to the xml, I get this:
Re: shapes in my TDBTree have incorrect coordinates
Hello,
Excuse me I misunderstood it.
I see if you expand level 0 then everything seems to work fine. Ie, expanding levels 0, 1 and 3:
However, I can reproduce the problem if I don't expand level 0 but I do expand any other level.
Could you please confirm it?
Excuse me I misunderstood it.
I see if you expand level 0 then everything seems to work fine. Ie, expanding levels 0, 1 and 3:
Code: Select all
NewShape.Expanded := (NewShape.Level=3) or (NewShape.Level=1) or (NewShape.Level=0);
Could you please confirm it?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: shapes in my TDBTree have incorrect coordinates
using
also seems to work on my end
Code: Select all
NewShape.Expanded := (NewShape.Level=3) or (NewShape.Level=1) or (NewShape.Level=0);