Activity › Forums › Adobe After Effects Expressions › Add button and textfield to UI
-
Xavier Gomez
August 22, 2013 at 3:01 pm“I would like the text to continue in a new row”
Ok so i had misread your question. It looks more natural on a new row than on a new column… But then i don’t know and i’m wondering if i lead you to a wrong direction with listboxes. I’m already curious how you could manage to get an item over two rows. What’s your secret ?!
Xavier
-
Jacob Danell
August 22, 2013 at 3:20 pmAh, sorry if I forgot to write before. I did it in photoshop just to be able to show what I was after instead of trying to explain 😛
Well there you have what I’m trying to create.
First add/remove to add/remove todos,
Second a box with the Todos and a checkbox to check the ones you have done
and Last a DropDown list where you can select witch todo-list you want to see (for multiply jobs)So far, with the ListBox everything is super easy to setup, now it’s only to link UI-groups to the DropDown list so you can show the list you want to see and hide the rest and if possible in some way, make the text start in a new line (but as it looks now it looks dark =/ )
-
Xavier Gomez
August 22, 2013 at 3:57 pmYou need to decide if you absolutely need multiline text.
If so, abandon the listbox, replace it by a group (orientation column) and instead of add/remove listbox items you add/remove groups (orientation row), each consisting of 1 checkbox and 1 multiline edittext. Pretty much the same thing but you loose the nice listbox properties.
Otherwise, i would showHeaders, with 2 columns, one for short title, the other for full “to do” descriptions. You get the column extendability which is quite useful.
-
Jacob Danell
August 22, 2013 at 4:41 pmhm… I think I’ll be done with the script, now when it’s so close to be done and later if it looks like a big problem, needing to scroll long to see all, I might change it to the way you said now.
Well thanks for all the help! Really helped me going 🙂
One last thing, is there somehow to see if a group has a listbox in it or not?p.s. also when I add a new item to the ListBox I make it checked = false but the checkbox doesn’t show until I click on a button or a box inside the UI.
My code is
function pressAddButton ()
{
var newName = prompt ("What To Do?","What To Do?");
if (newName != null){
var theNewListboxItem = theListBox.add("item", newName);
theNewListboxItem.checked = false;
}
}
-
Xavier Gomez
August 23, 2013 at 9:09 amFor the above code, unless i miss something, it is normal that nothing shows up since the checkbox status “false” is just an empty space.
To know if a group contains a listbox, since you are the one writing the script you can add to it the property “hasListbox”, set to true, and for the other groups do nothing. Then “if (something.hasListbox)” will tell you what you want. Not very constructive but it is simple and the fastest you can get. Otherwise, to know if ‘something’ is a listbox do “if something instanceof ListBox”. For instance to check if a group has a listbox in its immediate children it could be like this:
var hasListbox, K=theGroup.children.length, k;
for (k=0; k lt K; k++) if (theGroup.children[k] instanceof ListBox) {hasListbox = true; break;}
For a recursive search in eventual subgroups,
function search(cont, what)
{
if (cont instanceof what) return true;
if (cont.children) for (var K=cont.children.length, k=0; k lt K; k++) if (search(cont.children[k], what)) return true;
return false;
}
>> search(myGroup, ListBox);Xavier
-
Jacob Danell
August 23, 2013 at 9:47 pmI’m trying to use your recursive function but I get an error under “k lt K;”. It alerts for the “It” and doesn’t understand it. What exactly does that part in the script do and is it important?
Reply to this Discussion! Login or Sign Up