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


[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


Re: [Lazarus] How write a proper Type declaration with procedures?

2015-10-28 Thread Joe Shepherd

Thank you both - another case of not seeing the wood for the trees.

 

Joe

 

 
 



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


[Lazarus] How write a proper Type declaration with procedures?

2015-10-27 Thread Joe Shepherd
Hi

 

I have inherited a boon-doggle of a system, about 60% of which is in an old version of Delphi. I hope to use Lazarus/Free Pascal to re-implement for Windows , with a mySQL back-end on a Linux box.

 

This isn't real code, but a minimal example of what I want to do in a unit:

 

 TURLTable=class(TStringlist)
    private
   property Table: LinkArray;
    public
   procedure Insert(const s: string);
    end;
 

elsewhere I will have

 

var

   SpecTab: TURLTable;



 

SpecTable.Insert(some string')

 

When I come to write the implementation part of the unit, what's the syntax to refer to the property Table? If I use

 

procedure TURLTable.Insert(const s: String);

 

begin

   Table[1] := s

end;

 

I get the error 'No member is provided to access property.'

 

How can I acess private properties like this?

 

Sorry if this is naiveI've become involved in something that I really didn't anticipate.

 

Joe

---

joe.sheph...@cyberservices.com

Perth, WA, Australia

 

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