Re: [Lazarus] Treeview example(s) needed

2016-01-28 Thread Mattias Gaertner
On Thu, 28 Jan 2016 01:23:36 +0100
"Joe Shepherd"  wrote:

> Thanks, but that's hardly the way (with standalone buttons) anyone would use 
> a treeview.

It demonstrates adding, deleting and selecting nodes.


> Surely the TV's own events (onClick, onChange...) are preferable?

Do you mean you search general examples/documentation for the TV's
events like? Or do you need some help with specific events?


> Apart from some terse words about lack of information on StackExchange, I see 
> nothing on-line about them

Several examples use TTreeView. Use 'Find in Files' to search for
'TTreeView' in the 'lazarus/examples' directory.
For instance xmlreader/testxmlreder.lpi


Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Joe Shepherd
Thanks, but that's hardly the way (with standalone buttons) anyone would use a treeview. Surely the TV's own events (onClick, onChange...) are preferable? Apart from some terse words about lack of information on StackExchange, I see nothing on-line about them
 

Perhaps I need a different platform 

Joe
-
joe.sheph...@cyberservices.com
Pert, WA, Australia.

 
 

Sent: Wednesday, January 27, 2016 at 9:49 PM
From: "Vincent Snijders" <vincent.snijd...@gmail.com>
To: "Lazarus mailing list" <lazarus@lists.lazarus.freepascal.org>
Subject: Re: [Lazarus] Treeview example(s) needed


 
 
2016-01-27 6:01 GMT+01:00 Joe Shepherd <joe.sheph...@cyberservices.com>:




Hi

 

I'm having trouble with TTreeView - no doubt due to ignorance. Does anyone have simple example(s) of builing and using a treeview?

 






The lazarus source contains a treeview example:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/examples/treeview/?root=lazarus
 

Vincent


 

-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Marc Santhoff
On Mi, 2016-01-27 at 06:01 +0100, Joe Shepherd wrote:
>  
> Obvioiusly I'm missing a lot but I cannot find any example to dispel
> the fog. Anyone got one?

Not really. Some information can be found there:

http://wiki.lazarus.freepascal.org/XML_Tutorial#Populating_a_TreeView_with_XML

But I cannot say if that helps you. The main page in the wiki is this
one:

http://wiki.lazarus.freepascal.org/VirtualTreeview

and it shows the way to get a help file:

http://wiki.lazarus.freepascal.org/VirtualTreeview#Help

Have fun,
Marc

-- 
Marc Santhoff 


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Marc Santhoff
On Mi, 2016-01-27 at 11:21 +0100, Mattias Gaertner wrote:
> On Wed, 27 Jan 2016 09:16:12 +0100
> Marc Santhoff  wrote:

> The main page in the wiki is this
> > one:
> > 
> > http://wiki.lazarus.freepascal.org/VirtualTreeview
> 
> VirtualTreeView <> TTreeView

Oops, I see. At least I've learned something today.

Marc

-- 
Marc Santhoff 


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Mattias Gaertner
On Wed, 27 Jan 2016 06:01:24 +0100
"Joe Shepherd"  wrote:

>[...]
>newnode := tv.items.addchild(nil, 'A');
>newnode := tv.items.addchild(nil, 'B');
>newnode := tv.items.addchild(newnode, 'B1');
>newnode := tv.items.addchild(newnode, 'B12');
>newnode := tv.items.addchild(newnode, 'B123');  
>[...]
> If the treeview option tvoAutoExpand is True, I get the whole tree and can 
> click about the tree and select nodes. But if tvoAutoExpand is False, the 
> tree is (correctly) drawn collapsed, and  clicking to expand (eg node B), or 
> on a node with no children (eg Node A) both result in a SigSegV in 
> include/treeview.inc at line 1590 which is the indicated line here:

Clicking on nodes should not create AV, unless you have some more code
than just the above 5 lines.
The method GetLevel is not called by the LCL, so I guess you use it
somewhere.
Use the debugger to create a backtrace of the AV to find out what
causes the AV.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Vincent Snijders
2016-01-27 6:01 GMT+01:00 Joe Shepherd :

> Hi
>
> I'm having trouble with TTreeView - no doubt due to ignorance. Does anyone
> have simple example(s) of builing and using a treeview?
>
>
>
The lazarus source contains a treeview example:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/examples/treeview/?root=lazarus

Vincent
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Treeview example(s) needed

2016-01-27 Thread Mattias Gaertner
On Wed, 27 Jan 2016 09:16:12 +0100
Marc Santhoff  wrote:

> On Mi, 2016-01-27 at 06:01 +0100, Joe Shepherd wrote:
> >  
> > Obvioiusly I'm missing a lot but I cannot find any example to dispel
> > the fog. Anyone got one?
> 
> Not really. Some information can be found there:
> 
> http://wiki.lazarus.freepascal.org/XML_Tutorial#Populating_a_TreeView_with_XML
> 
> But I cannot say if that helps you. The main page in the wiki is this
> one:
> 
> http://wiki.lazarus.freepascal.org/VirtualTreeview

VirtualTreeView <> TTreeView

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Treeview example(s) needed

2016-01-26 Thread Joe Shepherd
Hi

 

I'm having trouble with TTreeView - no doubt due to ignorance. Does anyone have simple example(s) of builing and using a treeview?

 

Here's the sort of ignorance I confess to:

 

I have tv: TTreeview on a form, and code that adds some nodes:

 

       newnode := tv.items.addchild(nil, 'A');
       newnode := tv.items.addchild(nil, 'B');
       newnode := tv.items.addchild(newnode, 'B1');
       newnode := tv.items.addchild(newnode, 'B12');
       newnode := tv.items.addchild(newnode, 'B123');      

 

and that builds a tree OK, schematically like this

 

...A

...B

..B1

.B12

B123 

 

If the treeview option tvoAutoExpand is True, I get the whole tree and can click about the tree and select nodes. But if tvoAutoExpand is False, the tree is (correctly) drawn collapsed, and  clicking to expand (eg node B), or on a node with no children (eg Node A) both result in a SigSegV in include/treeview.inc at line 1590 which is the indicated line here:

 

function TTreeNode.GetLevel: Integer;
// root is on level 0
var
  ANode: TTreeNode;
begin
  Result := 0;
  ANode := Parent;         <<
  while Assigned(ANode) do
  begin
    Inc(Result);
    ANode := ANode.Parent;
  end;
end;  

 

 

Obvioiusly I'm missing a lot but I cannot find any example to dispel the fog. Anyone got one?

 

Joe
-
joe.sheph...@cyberservices.com
Perth, WA, Australia.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus