1938 Posted July 21, 2020 Posted July 21, 2020 Is there a way to set the selected node to the top of the treeview list? Or control where in the list the selected node starts? I've seen behavior (probably caused by me) where the selected node scrolls off of the screen and I want to push it to the top of the list. -1 Quote
Sherzod Posted July 21, 2020 Posted July 21, 2020 7 minutes ago, 1938 said: Is there a way to set the selected node to the top of the treeview list? Or control where in the list the selected node starts? I've seen behavior (probably caused by me) where the selected node scrolls off of the screen and I want to push it to the top of the list. Hello, Sorry, can you please explain in more detail? If possible, make a simple testcase, by specifying what behavior you want. Quote
1938 Posted July 21, 2020 Author Posted July 21, 2020 Yes thank you. A easy to see example is in the Rad Studio IDE. In the project "Structure" panel you see errors, Types, Procedures Classes etc... Expand those. Once a node is expanded that fills the panel with more child nodes than can be displayed, it forces that selected node to the top of the treeview panel. In my case, I am using memtable to fill the treeview. Some of the node lists are lengthy - maybe 200 or so nodes/child nodes. I want the expanded/selected node to go to the top of the panel when I click the "plus" to expand a node. I hope that helps. Quote
Sherzod Posted July 21, 2020 Posted July 21, 2020 3 minutes ago, 1938 said: A easy to see example is in the Rad Studio IDE. In the project "Structure" panel you see errors, Types, Procedures Classes etc... Expand those. Once a node is expanded that fills the panel with more child nodes than can be displayed, it forces that selected node to the top of the treeview panel. Sorry, can you make and attach here a gif file!? Quote
1938 Posted July 21, 2020 Author Posted July 21, 2020 In the attached gif's treeview-1 - shows how I want it to behave. That gif is from the RAD Studio 10.3 IDE. The selection relocates the selected node at the top. treeview-2 is the behavior I am getting. The treevew scrolls the seleted node off the screen. I would like to make user1 at the top when I select it. Thanks for your help. Quote
1938 Posted July 21, 2020 Author Posted July 21, 2020 I have tried UniTreeViewFolders.Selected.MakeVisible; But perhaps I don't understand what it is supposed to do or what event needs to contain the code. Quote
Sherzod Posted July 22, 2020 Posted July 22, 2020 6 hours ago, 1938 said: UniTreeViewFolders.Selected.MakeVisible; But perhaps I don't understand what it is supposed to do or what event needs to contain the code. LoadOnDemand = True ? Quote
Sherzod Posted July 22, 2020 Posted July 22, 2020 17 hours ago, 1938 said: In the attached gif's Thanks 17 hours ago, 1938 said: treeview-1 - shows how I want it to behave. That gif is from the RAD Studio 10.3 IDE. The selection relocates the selected node at the top. treeview-2 is the behavior I am getting. The treevew scrolls the seleted node off the screen. I would like to make user1 at the top when I select it. I am analyzing. Quote
1938 Posted July 22, 2020 Author Posted July 22, 2020 No, its set to false. Set to true, I get incomplete redraw of treeview. Sometimes only the root node. Quote
1938 Posted July 23, 2020 Author Posted July 23, 2020 On 7/22/2020 at 10:28 AM, Sherzod said: Which build are you using? 1.90.0.1533 Rad Studio 10.2 Quote
Sherzod Posted July 24, 2020 Posted July 24, 2020 On 7/22/2020 at 10:20 PM, 1938 said: No, its set to false. Set to true, I get incomplete redraw of treeview. Sometimes only the root node. Hi, Try to use this approach: UniTreeView.ClientEvents.ExtEvents -> function afteritemexpand(node, index, item, eOpts) { node.getOwnerTree().setSelection(node); item.scrollIntoView(true); //or by using Ext.defer //Ext.defer(function(){item.scrollIntoView(true)}, 50); } Quote
Andrew Spencer Posted December 4, 2024 Posted December 4, 2024 The above does what was requested, and has helped me make a better user experience for my use of TUniTreeView. I have a further slight modification for a slightly similar requirement. After I load the TUniTreeView (from various records in a relational database) with many items, I want to select a particular node (i.e. I search for, locate and then set structureTree.Selected), and then make sure that it is visible. I had thought that structureTree.TopItem := structureTree.Selected; would do that. But it does not appear to do anything. Any advice? UniGui 1.95.0.1592 Quote
Sherzod Posted December 5, 2024 Posted December 5, 2024 8 hours ago, Andrew Spencer said: would do that. But it does not appear to do anything. Hello, We will try to fix this in the next versions. Let me ask, are you using the trial version? Quote
Andrew Spencer Posted December 5, 2024 Posted December 5, 2024 No - this is a purchased version Quote
Stemon63 Posted December 5, 2024 Posted December 5, 2024 This is the same problem that I have already reported. So it will be fix in next release? Thanks! Quote
Sherzod Posted December 5, 2024 Posted December 5, 2024 5 minutes ago, Stemon63 said: So it will be fix in next release? 4 hours ago, Sherzod said: We will try to fix this in the next versions. Workaround for now: (When TopItem is changed, the tree view scrolls vertically so that the specified node is topmost in the list view) https://www.unigui.com/doc/online_help/api/uniTreeView_TUniCustomTreeView_TopItem.html UniTreeView.ClientEvents.ExtEvents -> function afterrender(sender, eOpts) { var me = sender; var view = me.getView(); view.focusRow = Ext.Function.createSequence( view.focusRow, function(d, b) { const record = this.getRecord(d); if (record) { var nodeEl = view.getNode(record); if (nodeEl) { var treeEl = view.getEl(); var nodeTop = Ext.fly(nodeEl).getOffsetsTo(treeEl)[1]; treeEl.scrollTo('top', treeEl.dom.scrollTop + nodeTop, true); } Ext.get(nodeEl).highlight("ffff9c", { attr: "backgroundColor", easing: 'easeIn', duration: 2000 }); } } ); } Quote
Andrew Spencer Posted December 6, 2024 Posted December 6, 2024 Done My "Forum email" (which is different to the account email) had been set. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.