Jump to content

Filter display of "GuiCtrlCreateTreeView"


 Share

Recommended Posts

Hi,

    In a complete project, I have a TreeView with lots of CheckBox items whose properties are shared with an external C-dll through an struct array. In this TreeView,

    I need to filter the list in this TreeView, like to reduce display. My final goal is having a field where user may enter a string to display only checkboxes whoses text contains this string.

    I have done a minimal test-case, but was not able to "hide" some items. In this case, I try to hide items whoses checkboxe is unchecked. I found a previous thread about TreeView (at https://www.autoitscript.com/forum/topic/118585-solved-disabling-parent-treeview-checkboxes/ ), but all I can do it ho hide the square of the checkbox, not the full line.

    Executing the attached script : all checkboxes are unchecked at start-up. Click on "B only" to select "B*" boxes. Then "View Sel" => I would like to see only "B*", to only 4 items without destroying handle/others info on "A*" items.

    If someone has the solution, please be welcome :)

Best Regards,

 

    JLF

CtrlTreeView.au3

Link to comment
Share on other sites

@jlf,

you cannot hide individual tree view items. you need to rebuild your tree view upon requirement.

if you are concerned about preserving handles to items, then good and bad news:

bad news: you can't preserve them.

good news: you don't need to. you are probably building your tree view to reflect a data structure. but the tree view is not only a reflection - it is also a data structure by itself. the difference between a tree view data structure and any other data structure is the unique ID. while a database record may have a UID which you correlate with the tree view item handle, the UID of a tree view item is the full text of itself prefixed with all parent branches, starting from the root.

so instead of reading the handle of a checked item to correlate with your data source, you can read the full text and correlate that.

another approach would be to ask how many levels does your tree view have. if it's a shallow tree (2-3 levels max) you can consider using list view instead, in with you can manage each item distinctively.

of course, you may be able to do that with a deeply-customized, owner-drawn tree view; however i'm not aware of the existence of anything of that sort.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

@jlf, care to share your solution? this is a forum, not a ticketing system; someone in the future may come across the same need, and will probably be quite frustrated if the topic ends with someone having a solution but not sharing it... :'(

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...