May 20, 2024, 02:52:28 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Treeview Expand and Collapse

Started by Andy, March 20, 2014, 11:49:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

I'm having a go at a registry editor project.

WARNING! - DO NOT CLICK ON "Delete Key" OR "Delete Value" buttons - at the moment there is no confirmation, they will be deleted - so please don't click them!!


So far i'm doing okay except for when I double click on an item to expand / collapse OR when I click on the Plus / Minus sysbols - when you do this the children of the parent are doubling up.

To combat this I use an array called [Viewed] to "keep" a list of what has been displayed, if it has already been displayed the don't display (insert into the tree) again, See lines 319 and 333.

The problem is doing this stops some sub keys / items from being displayed.

The bottom line is this - if I comment out lines 319 and 333 - items double up
If I use lines 319 and 333 some items / keys will not open or be displayed.

Help anyone?

Win = window
11 = treeview control
747 = Reg entry name listbox
748 = Reg entry type listbox
749 = Reg entry value listbox
12 = static displaying the full path of selected registry key / item

To make the program "workable", I have added "(+)"'s to the sub keys so the user knows there are children
under the item. Just double click on an item with a (+).

I have attached the code and the KMS.INC file you will need, change the
$include "C:\\KMS\\C3\\KMS.inc" to the location you save it to, and it must be added AFTER the
$include "windowssdk.inc" line.

Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

took me an hour to get rid of all the duplicate definitions so it would compile and then to straighten out the indentation so I could tell something about what was going on.

I added one line to the code you posted.
'Otherwise....
RootKey = strText
  SubKeys = 0
SubKeys = RegCountSubKeys(RootKey)
IF SubKeys > 0
rtlzeromemory(Viewed,sizeof(Viewed))   '<======================
FOR z = 0 TO Subkeys-1
SubKeyName = aRegEnumKey(RootKey,z)

and with that the branches would open.
Try it and see if it fixes your problem.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks Larry,

I do appreciate what you do, sorry about the indentation!

Managed to to fix the duplication of "children" using an array.

The code is now good for:
Viewing the registry
Add / Edit / Delete String or Dword values
Add / Delete Registry keys

I will post the code in the "User Offerings" section as soon as I've had a tidy up of the code.

One very (i'm sure) simple question:

If I have an edit control in a window
CONTROL dy3,@EDIT,"",10,80,500,25,@CTEDITLEFT,EDIT_1

How can I allow more text to be entered than the edit control size, say up to 255 characters?

Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

From the help file section on edit controls:

Quote@CTEDITAUTOH
Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero.
QuoteCONTROLCMD window | dialog, ID, @EDSETLIMITTEXT, length
Use this function to set the text limit for this edit control. The text limit is the maximum amount of text, in bytes, the edit control can accept either through pasting or typing. The default limit is 32767 bytes for multi line controls.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library