Tree View / Custom Properties PI

Brian Milby brian at milby7.com
Fri Aug 10 01:01:31 EDT 2018


Before going too far, I'd like to get some feedback on the best way to
address one of the issues that Curry brought up.

Currently, when in the Tree View widget (which is used in the Custom
Properties PI), if you click on the "+" icon to add a new array key, the
value in the existing key is lost if it is not already an array.  My
proposal here is to migrate the value to the new key (1).  If you clicked
the "+" again, then you would get the normal new key (2) with an empty
string as the value.

Line 1514 of the treeview.lcb file:
put **tElement** into tArray[1 formatted as string]

What is probably a bigger potential issue is if you set a value on a key
that is currently an array.  If that is done in the PI, then the sub-array
is lost and replaced with the value.  Still thinking on this piece (but the
change is going to be in the PI and not the Tree widget).  I'm thinking
that a confirmation dialog is appropriate here.

Here's a fix for (much of) the text selection issue:

Mac path:   LiveCode9.app/Contents/Tools/Toolset
/palettes/inspector/behaviors/revinspectoreditorbehavior.livecodescript

add the following handler:

after openField
   select the text of the target
end openField

That will auto-select text in the PI in many cases.  There is a need for
another statement in the custom properties behavior (here are lines 69-73
in the 9.0.1 source; 72 is the new line):
/palettes/inspector/editors/com.livecode.pi.customprops.behavior.livecodescript

      if the result is empty then
         put tKey into field "value" of me
         put item -1 of tPath into field "key" of me
         **select the text of field "key" of me**
      else

I have not looked into automatically selecting the newly created key, but
with the above 2 additions when you click on a line in the tree view widget
the key is selected with focus and ready for edit.  A tab will take you to
the value field with the text selected.

So, it looks like adding 4 lines of code to the IDE and changing 1 word in
the Tree View widget source can remove a few of the irritation points.
Before submitting anything, I do want to see if I can identify where to
address the resize issue mentioned above.

Thanks,
Brian



More information about the use-livecode mailing list