Announcement

Collapse
No announcement yet.

Object Plugin: TreeList

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Object Plugin: TreeList

    The TreeList is an advanced tree object that supports multi columns, checkboxes and icons, The perfect object to display related database info in one easy to navigate object.

    The TreeList Supports the following functions: (and a few more to add!)
    • TreeList.AddColumn
    • TreeList.InsertColumn
    • TreeList.RemoveColumn
    • TreeList.ClearColumns
    • TreeList.CountColumns
    • TreeList.GetHeaderTitle
    • TreeList.SetHeaderTitle
    • TreeList.GetColumnWidth
    • TreeList.SetColumnWidth
    • TreeList.GetHeaderHeight
    • TreeList.SetHeaderHeight
    • TreeList.GetHeaderResize
    • TreeList.SetHeaderResize
    • TreeList.GetHeaderAlign
    • TreeList.SetHeaderAlign
    • TreeList.AddRow
    • TreeList.LoadImage
    • TreeList.FreeImage
    • TreeList.AddImage
    • TreeList.RemoveImage
    • TreeList.ExtensionIcon
    • TreeList.ExtractIcon
    • TreeList.InsertRow
    • TreeList.CountRows
    • TreeList.RemoveRow
    • TreeList.ClearRows
    • TreeList.GetSelected
    • TreeList.SetSelected
    • TreeList.GetRowChecked
    • TreeList.SetRowChecked
    • TreeList.GetRowExpanded
    • TreeList.SetRowExpanded
    • TreeList.GetCellAlign
    • TreeList.SetCellAlign
    • TreeList.GetCellText
    • TreeList.SetCellText


    And supports the following events
    • On Create
    • On SetFocus
    • On KillFocus
    • On Select
    • On DoubleClick
    • On Expanded
    • On Checked
    • On HeaderClicked
    • On Key
    • On ContextMenu


    Requires Windows 2000 or above

    Consider this a WIP/Beta, still a few functions to add and the help file is incomplete, just wanted to get this out to get some feedback

    as always C&C welcome, and please, report bugs!

    Tested on Windows 7 Home Preimum (x86 & x64)
    Attached Files
    Embrace change in your life, you never know, it could all work out for the best

  • #2
    Oh My God!

    This is going to be one of the best plugins around, so useful!

    I do have one request though (bearing in mind I havent had major time to test yet) ... when you click on a parent check box it auto checks the child items?
    Last edited by boku; 01-17-2011, 05:32 AM.
    - BoKu -

    Comment


    • #3
      I don't have time right now to test it, as soon as i can I'll let you know.
      But before i test it, I have to say that it's another excellent plugin that my AMS will be glad to have in its plugin list!
      Thanks Riz! :yes

      Comment


      • #4
        Amazing Dean, well done! :yes
        Bas Groothedde
        Imagine Programming :: Blog

        AMS8 Plugins
        IMXLH Compiler

        Comment


        • #5
          Wow ...

          looking great and extremely usefull already as it is

          thx for sharing

          maybe science fiction, one never knows
          Code:
          TreeList.SetCellColor
          TreeList.GetCellColor

          Comment


          • #6
            when you click on a parent check box it auto checks the child items?
            i could add a extra argument to the SetRowChecked function to allow the checking/unchecking of the nodes child items, and maybe a extra property to do it automatically when clicked

            maybe science fiction, one never knows
            not fiction, very much a reality, already working on those functions :yes

            Thnaks for the feedback and kind words guys :yes
            Embrace change in your life, you never know, it could all work out for the best

            Comment


            • #7
              Wow rizla this is your masterpiece to date Mate! Congrats!

              Comment


              • #8
                Great one RizlaUK! Works like a champ on Vista 64. Looks like I’m going to have to dig out my MP3 player and finish it.

                Comment


                • #9
                  Dean, this works as a normal ListIcon too? So, I could disable the tree mode and disable the checkboxes?
                  If so, we wouldn't have to update ListIcon haha
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment


                  • #10
                    it can be used as a ListIcon yes, but theres things i want to do with the ListIcon i cant do with the TreeList, so it would be another functional object

                    anyhow, heres the update i promised

                    v 1.0.0.1 Update
                    Added: TreeList.GetTextColor, Gets the objects global text color.
                    Added: TreeList.SetTextColor, Sets the objects global text color.
                    Added: TreeList.GetBackColor, Gets the objects global background color.
                    Added: TreeList.SetBackColor, Sets the objects global background color.
                    Added: TreeList.GetCellTextColor, Gets a cells text color. (Overides global colors)
                    Added: TreeList.SetCellTextColor, Sets a cells text color. (Overides global colors)
                    Added: TreeList.GetCellBackColor, Gets a cells background color. (Overides global colors)
                    Added: TreeList.SetCellBackColor, Sets a cells background color. (Overides global colors)
                    Added: TreeList.GetRowImageIndex, Gets a rows image index.
                    Added: TreeList.SetRowImageIndex, Sets a rows image index.
                    Added: TreeList.GetRowData, Gets a rows data.
                    Added: TreeList.SetRowData, Sets a rows data.
                    Added: TreeList.GetRowSubLevel, Geta a rows sub level index.

                    Renamed: TreeList.LoadImage to TreeList.LoadIcon, function arguments have changed, check help file
                    Renamed: TreeList.FreeImage to TreeList.FreeIcon, function arguments have changed, check help file

                    Changed: TreeList.ExtensionIcon, function arguments have changed, check help file
                    Changed: TreeList.ExtractIcon, function arguments have changed, check help file
                    Changed: TreeList.AddRow, added optional Data argument, check help file
                    Changed: TreeList.InsertRow, added optional Data argument, check help file

                    Removed: TreeList.AddImage, Images now added to objects imagelist with TreeList.LoadIcon, TreeList.ExtensionIcon and TreeList.ExtractIcon.
                    Removed: TreeList.RemoveImage, Images now removed from objects imagelist with TreeList.FreeIcon

                    Fixed: Bug in TreeList.SetHeaderResize, -1 now effects all items, was not working!
                    iv also updated and compiled a proper help file and included a small example showing basic use
                    Attached Files
                    Embrace change in your life, you never know, it could all work out for the best

                    Comment


                    • #11
                      I have only one sugg that I tried to show in the screenshot.

                      1. When you click on one of the child element - the parent check box is painted in a square.
                      2. When you click on a parent check box it auto checks the child items.
                      Attached Files

                      Comment


                      • #12
                        I like both ideas

                        1, might not be possible, but i'll look into it

                        2, already working on some helper functions to achieve this, doing it automatically is a pain so it will be up to you to add your code into the OnCheck event, when its ready i will make an example showing how its done
                        Embrace change in your life, you never know, it could all work out for the best

                        Comment


                        • #13
                          A little Question about TreeList Object ?

                          While ago i had found an example showing how to set a file browser with a tree object , and i tried to modify its code so that i can apply it to a treelist object but all my effort on it came with nothing so please any help with this cod to be able to do this
                          Thanks a lot in advance ,,.
                          Code:
                          function FillTree(strRootFolder)
                          	Tree.RemoveNode("tree",1);
                          	Tree.SetEnabled("tree",false);
                          	StatusDlg.Show();
                          	AddFolderToTree("1",strRootFolder,true);
                          	StatusDlg.Hide();
                          	Tree.SetEnabled("tree",true);
                          end
                          
                          function IsFolder(strPath)
                          	local tblAtt = File.GetAttributes(strPath);	
                          	if(not tblAtt)then
                          		return false;
                          	end
                          	
                          	return tblAtt.Directory;
                          end
                          
                          function AddFileToTree(strNode,strFilename)
                          	local strShortName = strFilename;
                          	
                          	local bIsFolder = IsFolder(strFilename);
                          		
                          	local tlbSpliPath = String.SplitPath(strFilename);
                          	if(not tlbSpliPath)then
                          		return "";
                          	end
                          	
                          	local strTemp = String.TrimLeft(strFilename,"\\");
                          	local nFoundPos = String.ReverseFind(strTemp,"\\");
                          	local nImageIndex = 0;
                          	local nSelImage = 0;
                          	
                          	if(nFoundPos ~= -1)then
                          		local nLength = String.Length(strTemp);
                          		strShortName = String.Right(strTemp,nLength-nFoundPos);
                          	else
                          		strShortName = strTemp;
                          	end
                          	
                          	if(bIsFolder)then
                          		nImageIndex = 1;
                          		nSelImage = 2;
                          	end
                          	
                          	return Tree.InsertNode("tree",strNode,{Text=strShortName,Data=strFilename,ImageIndex=nImageIndex,SelectedImageIndex=nSelImage});
                          end
                          
                          function AddFolderToTree(strNode,strFolder,bAddRootItem)
                          	if(bAddRootItem)then
                          		strNode = AddFileToTree(strNode,strFolder);
                          	end
                          
                          	local nNodeCounter = 1;
                          		
                          	tblFiles = File.Find(strFolder,"*.*",false,true);
                          	if(tblFiles)then
                          		for i, strFileName in tblFiles do
                          			local strNodeIndex = strNode.."."..nNodeCounter;
                          			strNodeIndex = String.TrimLeft(strNodeIndex,".");
                          			
                          			local strAddedIndex = AddFileToTree(strNodeIndex,strFileName);
                          			if(strAddedIndex ~= "")then
                          				if(IsFolder(strFileName))then
                          					AddFolderToTree(strAddedIndex,strFileName,false);
                          				end
                          			
                          				nNodeCounter = nNodeCounter + 1;
                          			end
                          		end
                          	end
                          end
                          
                          function SetRootFolder(strFolderName)
                          	Input.SetText("inputFolder",strFolderName);
                          	FillTree(strFolderName);
                          end
                          
                          function UpdateFileInfo(strNode)
                          	Paragraph.SetText("info","");
                          	
                          	local strInfoText = "Select a file or folder.";
                          	
                          	local tblInfo = Tree.GetNode("tree",strNode);
                          	if(tblInfo)then
                          		strInfoText = "Full path: "..tblInfo.Data.."\r\n";
                          		local tblAttributes = File.GetAttributes(tblInfo.Data);
                          		if(tblAttributes)then
                          			strInfoText = strInfoText.."Created: "..tblAttributes.CreationDate.."\r\n";
                          			strInfoText = strInfoText.."Accessed: "..tblAttributes.AccessDate.."\r\n";
                          			strInfoText = strInfoText.."Modified: "..tblAttributes.WriteDate.."\r\n";
                          		end
                          	end
                          	
                          	Paragraph.SetText("info",strInfoText);
                          end
                          The original APZ example was posted some where in this forums before but i can't find it on my machine so i just posted the code ,,.

                          Comment


                          • #14
                            This is because in the original code you need to substitute the functions related to the standard "Tree" object with ones (if existing) proper to the "TreeList" object.

                            For example:
                            - at line #2, the function "Tree.RemoveNode" does not exists in the TreeList Object, use "TreeList.RemoveRow";
                            - at line #3, the function "Tree.SetEnabled" does not exists in the TreeList Object, try using Plugin.SetEnabled;
                            - the function "Tree.InsertNode" in TreeList Object is "TreeList.InsertRow";
                            - and so on...

                            Read with attention the TreeList help file and also check the example coming with the plugin.
                            We are slowly invading your planet to teach lazy humans to read the user manual.
                            But don't be scared: we are here to help.

                            Comment


                            • #15
                              Originally posted by Cybergraph View Post
                              This is because in the original code you need to substitute the functions related to the standard "Tree" object with ones (if existing) proper to the "TreeList" object.

                              For example:
                              - at line #2, the function "Tree.RemoveNode" does not exists in the TreeList Object, use "TreeList.RemoveRow";
                              - at line #3, the function "Tree.SetEnabled" does not exists in the TreeList Object, try using Plugin.SetEnabled;
                              - the function "Tree.InsertNode" in TreeList Object is "TreeList.InsertRow";
                              - and so on...

                              Read with attention the TreeList help file and also check the example coming with the plugin.
                              I have tried several combinations and changes of the code and all of them get failed , i also read the help file and checked the example given with the plugin as well as the pieces of code examples on the help file before i got here ,,.
                              Thanks a lot in advance ,,.

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎