Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(04-17-2019, 11:00 PM) Wrote: Denville,

It sounds like your tree isn't constructed properly.  With all of that stuff not working... (as opposed to just a piece not working that could be something smaller)

My (Delphi) treeview code looks like this:


// loop through studies and reports.  Studies are parents to reports
lStudyNode := ProjectTree.Items.Add( nil );
lStudyNode.Caption := 'a Study Caption';
lStudyNode.Expanded := false;

lReportNode := ProjectTree.Items.Add( lStudyNode );
lReportNode.Caption := 'a Report Caption';
// stop looping

Then I set the overall on click for the tree nodes like this:
ProjectTree.TreeItemClick         := ProjectTreeTreeItemClick;

If you set DoServerSidePlusMinus, you'll get the onPlusMinus event fired when you click the plus/minus.  Otherwise it will only occur client side. If you've got DoServerSidePlusMinus set to false, and your nodes aren't opening and closing, you're probably missing JS code somehow. (or you've overridden CSS maybe?)

Your code looks right to me.  (Same as mine but the caption is set in the Add() method.  But if stuff looks corrupted, check to make sure you're not reusing tnp or other nodes you're creating incorrectly.  For a test, maybe create them with static code rather than using a loop.  And use different variables for the nodes to be sure you're not stomping on existing pointers.  Also, you can build the tree in the designer.  That would enable you to see if they open/close and allow selection properly before you try to create it at run-time.

Hope that helps,

Hi, thanks.  OK, a number of things have occurred, specifically..
(1) - I had a drive failure following which I have a brand new ssd with new installation of W7/64 fully up to date.  I installed XE7 C++ Builder (update 1), opting not to install IW.  Then I ran the IW bundled removal tool which said it was successful but some files were left which should be removed manually( unfortunately it didn't say which).  Then I installed latest IW (.20), and allowed it to run the unbundle tool again.
Now I built a new IW project with just a button and a treeview.  The result was EXACTLY as before in every respect.
(2) I forked out and updated my license which had apparently expired in late 2018 (how time flies) and installed the new key.  Now, the 'evaluation' problem seems to have gone away - great.  But...

I am left with the original TreeView problem - nothing about it seems to work.  This is the code in its entirety...

static TIWTreeViewItem *tnp, *snp;

void __fastcall TIWForm1::IWButton2AsyncClick(TObject *Sender, TStringList *EventParams)
    tnp = LogTreeView->Items->Add( NULL );
    tnp->Caption = "First Node";

    snp = LogTreeView->Items->Add( tnp );
    snp->Caption = "First Sub Node";

    tnp->Expanded = false;

void __fastcall TIWForm1::LogTreeViewTreeItemClick(TObject *Sender, TIWTreeViewItem *ATreeViewItem)
String us = ATreeViewItem->Caption;

us = us;

Just as before, the TV displays expanded with the + and - ineffective, and (double) clicking on one or t'other fails to fire the Click event.  I have tried setting AsyncMode (default True) to both T and F, and setting DoServerSidePlusMinus (default True) set both T and F.  I added the following code with no success:

void __fastcall TIWForm1::LogTreeViewPlusMinus(TObject *aSender, bool aIsPlus)
    tnp->Expanded = aIsPlus;

Please, what have I missed ?


Messages In This Thread
HELP TIWTreeView - by denville - 04-17-2019, 11:33 AM
RE: HELP TIWTreeView - by Jose Nilton Pace - 04-17-2019, 01:53 PM
RE: HELP TIWTreeView - by denville - 04-17-2019, 03:57 PM
RE: HELP TIWTreeView - by - 04-17-2019, 11:00 PM
RE: HELP TIWTreeView - by denville - 04-21-2019, 05:34 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)