Does anyone know if it's possible to have a different command be executed depending on which item in a text scroll list is double clicked. In the docs, it looks like it just works generally. No matter what is double clicked on produces the same result. If it's not possible, does anyone have an idea how to have a list of object with different command shooked up to each one?

Thanks for any help.

GDC

01-08-2004, 09:58 PM

your are right, the textScrollList executes the same command for every doulbe click.

One way around this is to have a proc that can determine whats been click and then makes the appropriate call to another proc.

--g

ajk48n

01-08-2004, 11:11 PM

Thanks for the reply. I don't know if the proc thing will work for me, I'll have to mess around with it. Basically what I want to do, is when you click on a button, it adds a line of text to the text field. Then when you click on the item in the text field it lets you edit properties of that button. This means that whatver is run when the item is clicked has to know the specific name of the button pressed. The only wasy I can think of at the moment, is to have th eline of text be the actual command, and then just feed that string to the "eval" command. Unfortunately this is very intuitive in my script.

If anyone has any ideas, they would be greatly appreciated.

macaroniKazoo

01-09-2004, 04:30 AM

its pretty easy to do what you're after using GDC suggestion.

so just say u have a scroll list with 3 things in it:
itemA
nextItem
nipples!

PS most of that code is probably wrong, so don't go cutting and pasting. :) I didn't refer to the docs, so the flag names are probably wrong.

ajk48n

01-12-2004, 03:24 AM

makaroni: Thanks for the help.

That would work if the action I wanted to perform used the exact name in the textscrolllist, but if it doesn't, then the procedure thing doesn't seem to work.

Let's say the list contains:
myButton
mySymbol
Button2

If I doubleclick on one of them, I want an edit window for that item to open. For this to happen I call my edit procedure with the name of the button as an argument. Since the name of the buttons that can't be passed to the procedure aren't known before it is run, I pass the entire name of the button, such as window2|columnLayout1|myButton. I have to do this, since there could be multiple buttons with the same names. So basically, I need the list to run something without relying on the actual strings in the list.

I might just have to find out another way to do it.

macaroniKazoo

01-12-2004, 03:40 AM

:) i just sort replied to this thread on melscripting.com...

but yeah, try using something like a rowColumnLayout with a checkbox, and text. checking the checkbox "selects" the item.

the advantage of this, is that you can store individual info with each item in the UI's docTag.

for example, create a proc that makes a new rowColumn layout. 2 columns wide, the first column has a checkbox, the second, plain text. right clickin on the text could bring up a menu of commands to do to that particular item. the full path name of the thing can then be stored in the docTag of either the text, or the rowColumnLayout... you could also make left clicking the text select the item as well (ie have a popupMenu work on left click, which simply checks the checkbox relevant to that item)

this way certainly gives u heaps more power in terms of what you can do with each individual item. i have a lot of scripts use similar technique. :)

brubin

01-12-2004, 11:04 PM

another pointer:
most UI-elements store annotations with the -ann flag. if you put complicated bullshit into that , like e.g. path-names, you can still query that and still give your buttons nice names.

another thought: your proc can parse your buttonNames for keywords like "nippleButton", "nippleSymbol" or "nipplePinch" , and then "switch" for occurances of your keyword like:

third:
your buttons can have the same dynamically created name but with increments in number.
to make this more clear, let's say you have a procedure that creates a new element in your list by something like:

that way your very fist button will be referenceable as "myButton_0"
and any subsequent will be "myButton_1", "myButton_2", etc...

try it.
HIH
s.

macaroniKazoo

01-12-2004, 11:08 PM

most UI-elements store annotations with the -ann flag. if you put complicated bullshit into that , like e.g. path-names, you can still query that and still give your buttons nice names.yeah brubin, its better to use the docTag for that, because the annotation flag is visible to the user. if you hover your pointer over a ui object for long enough, it displays the text stored in the annotation flag. so better to store it where the user can't see it.

well, thats my opinion anyways. :)

CGTalk Moderation

01-17-2006, 03:00 AM

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.