Page 1 of 1

Get the caption of a TreeNode selected in TIWCGJQTreeView

PostPosted: 18 Sep 2013 14:51
by fcoalvarado
How can I get the caption of the item select in a TIWCGJQTreeView?
The TreeView1JQEventsClick and TreeView1JQEventsSelect events are fired
when the user clicks anywhere in the tree view, but I can't get the
caption of the selected item.

Also, how you set a different picture for sub-items?
I dropped a TIWImageList, set the TIWCGJQTreeView.Images property to it
and use this code:

tvSubItem := tvNode.SubItems.Add;
tvSubItem.Picture.ImageIndex := 1;
tvSubItem.Caption := 'This Caption I need to Get';

but the image is the same for parent and child item.

Best Regards

Francisco Alvarado

Re: Get the caption of a TreeNode selected in TIWCGJQTreeVie

PostPosted: 18 Sep 2013 18:07
by Alexander Bulei
Hi fcoalvarado,

For do this, you need activate UIPlugin and use OnSelect event (event more appropriate).

Then use this

delphi code
JQTreeViewOptions.UIPlugin.SelectedNode


Best Regards.

Re: Get the caption of a TreeNode selected in TIWCGJQTreeVie

PostPosted: 18 Sep 2013 20:19
by fcoalvarado
Thank you, that worked!

delphi code
procedure TRBDocs0.tvDocumentsJQEventsSelect(Sender: TObject; AParams: TStringList);
var
s: String;
i: Integer;
begin
// Just to know what's in the parameters
for i := 0 to AParams.Count -1 do
s := s + '; ' + AParams[i];
// Only need the children captions
if not tvDocuments.JQTreeViewOptions.UIPlugin.SelectedNode.HasChildren then
eCaption.Text := tvDocuments.JQTreeViewOptions.UIPlugin.SelectedNode.Caption;
end;