Page 1 of 2

A Simple Tree Control for use in Revolution/LiveCode.

Posted: Sun Nov 28, 2010 12:06 pm
by Dixie
The 'dvField' Library creates fields that can be used as a 'tree' control that in Runtime Revolution's Revolution / LiveCode stacks and standalones. It will run under both MacOS X and Windows and is simple to use.

A 'dvField' can be placed on any card... well, that makes sense, and what you would expect... more than one 'dvField' can be placed on a card...

A 'dvField' is also able to be created on a card and then used throughout the stack. If you are using a 'dvField' as a source for navigation and would like it to appear on each card to which you navigate, the 'dvField' is updated by the 'dvLibrary' when you move to a different card.... This is opposed to having a 'dvField' , that is being used as a 'source' field on just one card and then showing different groups of say 'fields, buttons and images' when you click on a leaf.... which sometimes can turn into a headache.

- Create Mac or Windows style 'dvField' tree fields.
- Import data into a 'dvField' from tab-delimited text files or variables from in your scripts
- Change the names of branches and leaves with the popUp menu or script.
- Change the order in which branches and leaves are displayed
- Choose different branch and leaf icons.
- Change the colours of the 'dvField' background to suit the look of your stack.
- Use different colours with which to display branch and leaf text.
- Change data and the look of the 'dvField' on the fly, through a popUp Menu in the IDE.
- Use 36 different commands to control the 'dvField' by script

This is a beta version and cannot yet be registered…. that will be possible within the next few days…

Download the Beta from :-
http://www.ihouse.on-rev.com/ihouse-dvfield.html

I would be pleased to hear your questions & comments
info@ihouse.on-rev.com

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Sun Nov 28, 2010 2:28 pm
by WaltBrown
Dixie,
Very nice, thanks!
1. I liked the active/passive background color feature.
2. I assume "plus" and "minus" can be used instead of a color in dvBranchIndicator? (I haven't tried it yet). It wasn't mentioned in the description.
3. Can the left edge margin be adjusted?
4. Does the library limit icon selection (the description makes it sound like it does), or can any icon ID be used?
5. Is it possible to not save changes made using the shift-option-click method? It appeared the changes were saved, but the IDE didn't know there had been changes and doesn't ask the question.
6. Do you also plan on a dvVariableHeight setting, so that the overall field acts like a drop down menu above other card elements?
7. Any thoughts/limits on having nested branches?
8. Does "dvCreate" return the dvFieldID?

Thanks again! Excellent delivery and demo as well!
Walt

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Sun Nov 28, 2010 2:50 pm
by Dixie
Hi Walt…

Thanks for the nice comment.

1. I put a 'plus minus' indicator into the library as that seems to be what is the preferred way of showing a user whether or not a branch is expanded or collapsed under windows… otherwise 'triangles' are used at the moment.

3. To make the 'dvField' width larger, place the cursor at the 'right edge of the 'dvField', the cursor will change to a drag icon… you can then adjusted the width of the field… there is no maximum to the width, but the minimum width is constrained by the formatted width of the field.

4. At the moment there are only a few icons that can be used as branch indicators and around 9 icons that can be used in front of a leaf… Over the next few days I intend to allow a user to use their own images for branch indicators, branch and leaf icons…

5. The changes should not be saved unless you save the stack…

6. Walt, I had not considered a variableHeight setting… mmm

7. I have thought about nested branches… if it is wanted, I will implement it.

8. When you create a field, there is a 'dvPick' handler in the script of the 'dvField' group, the ID of the 'dvField' is returned in the handler.. look at 'dvPick' under the branch 'dvField Commands'.

be well

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Mon Nov 29, 2010 4:12 pm
by WaltBrown
Hi Dixie. A couple clarifications:
1. I put a 'plus minus' indicator into the library as that seems to be what is the preferred way of showing a user whether or not a branch is expanded or collapsed under windows… otherwise 'triangles' are used at the moment.
I should have said, are the words "plus" and "minus" the way to tell it to use plus and minus instead of colored triangles? As in "dvBranchIndicator mydvFieldID, 'plus' " or "dvBranchIndicator mydvField, 'plusminus' ", or something like that?
8. When you create a field, there is a 'dvPick' handler in the script of the 'dvField' group, the ID of the 'dvField' is returned in the handler.. look at 'dvPick' under the branch 'dvField Commands'.
My issue here is that I see that the dvFieldID is used as an identifier for many of your commands(for example the dvBranchIndicator command above), and that waiting for it in a dvPick handler can be too late. If I am building the fields programatically, I would need the field ID before the menus are used - for example I may have a menu creation function and a separate menu content filling function - they would each need to know which dvField they are working on.

Best, Walt

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Mon Nov 29, 2010 5:57 pm
by Dixie
Hi Walt...

To get the 'dvField ID' prior to using the 'dvField'

Code: Select all

put the short ID of field 1 of group "dv MyField" of card X
In this example I have named the 'dvField group'. You can give the group any name that you wish... there is one caveat to this... the name of the 'group' must always begin with 'dv' as the library sometimes uses this to check if the group is a 'dvField' group or not.

To change the branchIndicators to the 'windows' plus & minus look...

Code: Select all

dvBranchIndicator 1018, "plus & minus"
Or, if you don't know the short ID of the 'dvField' but as long as you know the name you have given the 'group'... And in this example the name of the dvField group is 'dv MyField'

Code: Select all

dvBranchIndicator (the short ID of field 1 of group "dv MyField"),"plus & minus"
I have attached a stack, showing this working

I hope this helps... be well

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Tue Nov 30, 2010 1:01 am
by WaltBrown
Great, thanks!
Walt

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Tue Nov 30, 2010 6:31 am
by WaltBrown
Hi Dixie.
How does your library handle errors? It threw an error but couldn't tell me any other details because the stack is password protected. It also didn't post anything in the result, just exited out. Here's my code.

Code: Select all

on mouseUp
   local tMenuList, tLine, tLeafName, tMenuID, tBranchName
   put fld "fMenuList" into tMenuList -- my comma and return delimited list for menu construction
   put the ID of grp "dvMenu" into tMenuID -- a newly created dvField named dvMenu
   repeat for each line tLine in tMenuList
      put item 1 of tLine into tBranchName
      dvBranchAdd tMenuID, tBranchName, true -- this is where the script errors and terminates execution
      if the result is not empty then answer the result  -- this never executes
      delete item 1 of tLine -- delete the branch name from the list
      repeat for each item tLeafName in tLine
         dvLeafAdd tMenuID, tBranchName, tLeafName, true
         if the result is not empty then answer the result
      end repeat
   end repeat
end mouseUp
Thanks, Walt

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Tue Nov 30, 2010 3:39 pm
by Dixie
Hi Walt...

To create a new 'dvField' and populate it straight away as you are trying to do in your script, the 'dvLibrary' requires only 'two' lines of script..

Code: Select all

on mouseUp
   dvCreate false
   dvImport (the short ID of fld 1 of the last group of this card),"clean","open","./villageList"
end mouseUp
In the example above, because the 'asSource' parameter of the 'dvCreate' command is false, when the 'dvField' is created, the 'dvField' will be created at the loc of the card.

The 'dvImport' command allows you to import from a tab-delimited text file or tab-delimited script variable. Since the value of the 'method' pararmeter is 'clean' the data from the text file will replace whatever is presently in the 'dvField', if the value of the 'method' parameter had been 'after' then the data brought into the field would be placed, after, what is already in the 'dvField'.

The import can be from a tab-delimited text file or a script variable. The first item of each line becomes the name of the branch, the items that follow become the leaves. The problem here is that you are delimiting the data you wish to import with 'comma' not 'tab'.

The syntax of the 'dvCreate' and 'dvImport' commands' can be found under 'dvField Commands' in the docs. The 'dvBranchAdd' and 'dvLeafAdd' commands are really for adding branches and leaves to a 'dvField', as situations in the changing of you data demands, in the running of your stack(s).

I have also e-mailed you off list with a working example stack...

be well

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Tue Nov 30, 2010 7:08 pm
by Dixie
Thanks to all those who have emailed me...
I have updated the 'dvLibrary' today and fixed the 'bugs' that were pointed out to me..
Thanks for the interest

be well

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 2:35 pm
by Mark
Dixie,

I just opened your stack and it throws an error, saying there is no stack dvLibrary. The script shows that you exect that stack to be available in a particular location. This doesn't work for me. Can you add something to make it really simple to get your stack(s) working?

Thanks,

Mark

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 3:21 pm
by Dixie
Hello Mark...

I am about to make a couple of assumptions.. :-)

I assume that you downloaded the 'dvField Folder.zip'
In the 'dvField Folder' there are three stacks.. 'DataView Mac.rev', 'DataView Win.rev and 'DVLibrary.rev'

When you opened 'DataView Mac.rev' or 'DataView Win.rev' was the 'DVLibrary.rev' stack in the same directory/folder ? If this was the case then I presently am at a loss as to why one of these stacks should have thrown an error.

An error is thrown if the 'DVLibrary.rev' stack is not in the same directory/folder as the 'DataView Mac.rev' or 'DataView Win.rev' stacks ... whichever of the two you opened.... I just tried it.

Or is your question to add some script to allow you to have a choice as to where you would like the 'DVLibrary' to be located ?

As you have thrown me into a panic ... :-) I downloaded the 'dvField Folder.zip'... uncompressed it and double clicked on the 'DataView Mac.rev' stack and have found that it opened without a problem. The 'DataView Mac.rev' stack is in the same folder as the 'DVLibrary.rev' stack.

be well

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 3:42 pm
by Mark
Hi Dixie,

No, i didn't download anything., except for the stack that you posted here. Instead of letting the stack throw an error, you could check whether all necessary files are available and show a dialog if not. Then include a button on the dialog to open your homepage where people can download your libraries.

Kind regards,

Mark

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 4:00 pm
by Dixie
Hi Mark...

Thanks for pointing that out to me... I have amended the .zip file.

take care...

Dixie

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 5:42 pm
by Mark
Alright, Dixie, that's a solution, just thought it could still made easier with a little effort.

Best,

Mark

Re: A Simple Tree Control for use in Revolution/LiveCode.

Posted: Thu Dec 02, 2010 6:20 pm
by Dixie
Mark...

A little effort has been expended... :) If you care to take a look now.

be well

Dixie