Profile Picture

NTreeList help

Posted By JSW W. 13 Years Ago
Author
Message
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hello JSW W.,

To display "..." when there is no data you can check for String.Empty and set Value of the subitem to "...".

You are saying that when you click on the header column your application was shutting down. Could you post an example application that demonstrate it because we can't reproduce it.

To disable column sorting you can attach to ColumnNotify event and in the event handler you should check the event argument's NotifyCode property whether is ColumnSortingNotifyCode, and if so you can set the event argument Cancel to true:

void nTreeList1_ColumnNotify(object sender, NTreeListColumnNotifyData data)
{
if (data.NotifyCode == NTreeList.ColumnSortingNotifyCode)
{
data.Cancel = true;
}
}

If you want to be able to change the state of the NTreeListNodeBooleanSubItem you need to know its index in the node that host it.
You can attach to MouseClick event and in the event handler you can change its state
Let say that the 3rd column in your NTreeList contains NTreeListNodeBooleanSubItems, then your MouseClick event handler should look similar to this:

void nTreeList1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
NTreeListNode node = (NTreeListNode)nTreeList1.ItemFromPoint(new NPoint(e.Location));
if (node == null)
return;
NTreeListNodeBooleanSubItem item = ((NTreeListNodeBooleanSubItem)node.SubItems[2]);
if (item == null)
return;
item.Value = !item.Value;
}
}

The drawback here is that the check state will change if you click on any of the subitmes that belongs to this node.

Best Regards,
Nevron Support Team



JSW W.
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)Supreme Being (127 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 127, Visits: 1
Dim node As NTreeListNode
While reader.Read()
node = New NTreeListNode()
Dim index As NTreeListNodeNumericSubItem = New NTreeListNodeNumericSubItem
index.Column = NTL_PluginManager.Columns("id")
index.Value = reader.GetInt32(0)
node.SubItems.Add(index)
Dim index_parent As NTreeListNodeNumericSubItem = New NTreeListNodeNumericSubItem
index_parent.Column = NTL_PluginManager.Columns("parentID")
index_parent.Value = reader.GetInt32(1)
node.SubItems.Add(index_parent)
.....
Dim install_path As NTreeListNodeStringSubItem = New NTreeListNodeStringSubItem()
install_path.Column = NTL_PluginManager.Columns("ProgramPath")
install_path.Text = reader.GetString(4)
node.SubItems.Add(install_path)
NTL_PluginManager.Nodes.Add(node)
End While

First on the string column if no data from reader ... it will display

Then if i click on header on UI (to sort table) the application shutdown.

I have already disable sortable in each column but it did not take effect... how to disable sorting when click on the header of the table?

Also my Check can not be edit how to make it editable ... also please give me event on check box change for me too so i can write code in it.

Best,




Similar Topics


Reading This Topic