Declaring var, changing the name

I have an myArray created from list of master pageItems:
myDoc.masterSpreads[0].pageItems.everyItem().name.sort());
I am going to use every of this Array element in my dialog as a
checkboxControls.add ({staticLabel: myArray[k]});
At the same time I should declare a variables which will keep user checkedState:  .
So thats should be myChck_1, myChck_2, ... myChck_n,  - depends on myArray.length - declared.
How can I declare variables with names changing with counter "k" value?
Thx

Let's try to make it clear.
Given an array of strings—say myNames—the goal is to associate a control (here a checkbox) to each string.
The first stage is to create each control within the UI container. This can be done easily, as illustrated in the original post:
// myNames is an array of strings
var i;
for( i=0 ; i < myNames.length ; ++i )
   myCheckboxControls.add({ staticLabel: myNames[i] });
The above code produces the corresponding control objects—instances of CheckboxControl—but it does not provide a convenient way to access these objects using the original index (in myNames). What the author needs is to keep a reference to each control and to have access to each reference the same way he loops through myNames (i.e., by index). Hence, the ideal structure for this is another array.
The point is that the CheckboxControls.add(...) method returns a reference to the CheckboxControl object  it just created. You can store this reference in a variable, or directly within your destination array.
In JavaScript, arrays basically behave as regular objects in that you can fill them 'on the fly' using an integer—the index—in the role of the property name. We can therefore develop the initial code as follows:
// myNames is an array of strings
var i;
var destArray = []; // declare an empty Array
for( i=0 ; i < myNames.length ; ++i )
   destArray[i] = myCheckboxControls.add({ staticLabel: myNames[i] });
The only improvement is that the reference to each newly created control is registered in destArray.
> How does one loop through the new array for the names while also looping through the checkbox array?
In fact, the code loops through an existing array (myNames), builds for each index a control based on myNames[i] and stores the corresponding reference in destArray using the same index. The resulting array is gradually filled during the loop. and the correspondence between destArray and myNames is maintained through a common index.
Now, given a specific index, k, one can easily access to both the corresponding label (myNames[k]) and the corresponding control state: destArray[k].checkedState.
@+
Marc

Similar Messages

  • Possible to change the name of shared folders?

    I deleted the original shared public folder that looks like "User's Public Folder". When I went to add the Public Folder back it ends up being shared with the name "Public". Is it possible to change this name to something more descriptive? I have several Public folders being shared (several accounts on the computer) and having them all shared as Public makes it a bit hard to determine which account's Public folder you are looking at. Does anyone know how to change the name?

    Okay, after some searching around, I figured it out. Primarily I got most of it from here: http://discussions.apple.com/message.jspa?messageID=6266526 , but I added something else to make it work better. The linked post mentioned that they got it to work so you can see "username's Public Folder" when someone file shared from another Mac, but in the Sharing Preference, it would still read as "Public". Well I managed to figure out how to fix that too. Bare with me.
    1) Make sure the Public folder in question is set up to be shared in the Sharing Preferences
    2) Go to System Preferences > Accounts
    3) Control Click the username in question and click Advance Options.
    4) Copy the data (the bunch of numbers & letters) from the UUID field. (you'll need it for later, save it to a txt file temporarily, you'll be overwriting your clipboard later)
    5) Close System Preferences
    6) From the Finder Menu click "Go" > "Go to Folder..." and enter this /var/db/dslocal/nodes
    7) Then do a "Get Info" on the "Default" folder and allow EVERYONE read+write access
    8) Do the same for the the following two folders, CONFIG and SHAREPOINTS
    9) "Get Info" on the "Public.plist" file and allow EVERYONE read+write access (BACKUP THIS FILE)
    10) Rename the "Public.plist" to "Username's Public Folder.plist"
    11) Open the file in a text editor and change every instance of "Public" with "username's Public Folder" (except for <string>/Users/USERNAME/Public</string>. Thats the actual folder location you don't want to change that.
    12) Now what you need to enter this
    <key>sharepointaccountuuid</key>
    <array>
    <string>NUMBER</string>
    </array>
    It goes between <key>name</key> & <key>sharepointgroupid</key> sections. It should look like the following:
    </array>
    <key>name</key>
    <array>
    <string>Username's Public Folder</string>
    </array>
    <key>sharepointaccountuuid</key>
    <array>
    <string>NUMBER</string>
    </array>
    <key>sharepointgroupid</key>
    13) Now Paste the UUID number you got before where I have NUMBER written above. Make sure the line spaces and indents match the other entries on the file.
    14) Save the file and change the permissions to your new "Username's Public Folder.plist" and the other folders you changed back to EVERYONE "no access".
    15) Now the link said to restart File Sharing. I decided to reboot for good measure.
    Once done you should see "Username's Public Folder" in the Sharing Preferences and when other Macs try to file share.
    Works perfectly for me, and I hope that works for you too!

  • How to change the name of column in ActionScript?

    I possibly know how to change the name of the column in DataGrid using mxml but dont know how  to change the name of column in  DataGrid using  ActionScript.
    var newDataGrid:DataGrid=new DataGrid();
         newDataGrid.dataProvider=arrayCollection():
    It takes the default names from arraycollection but I wanted to give any column names which I want through ActionScript.
    Please HELP!

    Give your datacolumn and id.  Then set the property for that column through the datacolumn id.
    DataGridColumn id="nameDC"
    Script:
    nameDC.headerText = "Name";

  • I need to change the name of Schema in the Insert command by using variable

    Hi
    I need to write a code to populate 450 schemas having same table names and also specify the columns needed to be inserted. for that i am trying to make the Schema Name a variable and put the whole statement in a loop to change the name of the Schema. its not working can any one guide me in this..Thae sample of my insert statement is
    INSERT INTO A01.tablename
    In this the "A" is constant and 01 is being changed to 02...450..
    Thanks

    Not sure to completely understand your need, but assuming that column names and values to be inserted are the same for all schemas, here a short example :
    SQL> desc a001.test
    Name                                      Null?    Type
    A                                                  NUMBER
    B                                                  VARCHAR2(10)
    SQL> desc a002.test
    Name                                      Null?    Type
    A                                                  NUMBER
    B                                                  VARCHAR2(10)
    SQL> desc a003.test
    Name                                      Null?    Type
    A                                                  NUMBER
    B                                                  VARCHAR2(10)
    SQL> declare
      2     i       number;
      3     str     varchar2(100);
      4  begin
      5     for i in 1..3 loop
      6             str := 'insert into a'||lpad(i,3,'0')||'.test(a,b) values(1,'||chr(39)||'ABC'||chr(39)||')';
      7             execute immediate (str);
      8     end loop;
      9     commit;
    10* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> select * from a001.test;
             A B
             1 ABC
    SQL> select * from a002.test;
             A B
             1 ABC
    SQL> select * from a003.test;
             A B
             1 ABC
    SQL>                                                                          

  • I want to change the name of paragraphs styles. Is this possible by script.

    I want to change the name of paragraphs styles. Is this possible by script.
    Thank you

    Hi Hasvi,
    May the below coding helps for your question:
    var myDocument = app.activeDocument
    var myPStyles = myDocument.paragraphStyles.everyItem().getElements()
    for(i=2; i<myPStyles.length; i++)
    myPStyles[i].name = "A_".concat(myPStyles[i].name);   //Please change as per your requirement
    //myPStyles[i].name = "BBBBBB_".concat(myPStyles[i].name);
    Please use the below URL for more details.
    http://forums.adobe.com/message/4909340#4909340
    If my answers helps you, please provide "Helpful" or "Correct Answer" for me.
    Thanks
    Siraj

  • How can i delete my  music from itunes it dont let me also how to change the name of the ipod shuffle it dont let me

    i need help please help me on itunes i try to change my name for the ipod shuffle and it dont let me it dont do anything also when i try to delete the music on it it dont show me if i want to delete or not the font is just gray and dont show any opitions also when i go on my iphone it lets me do all the stuff that it dont let me do i connect my iphone and it lets me delete music and change the name but the shuffle doesnt

    What happens when you try to change the Shuffle's name from under the Devices section in the left hand pane of iTunes?
    Is your iPod set up to manually manage its contents.  For more information, see your iPod's User Guide.
    http://support.apple.com/manuals/#ipodshuffle
    B-rock

  • I changed the name of my imac to reflect it's new location, but inadvertently, it unchecked the box to allow the administrative user account to administer the machine.  I am trying to reinstall with a time machine backup and am unable

    I need a little help.  I changed the name of my imac to reflect it's new location, but inadvertently, when I saved the change, the system unchecked the "allow this account to administer the computer" so now I can't make any changes....  I tried to reinstall the OS, but it wants me to go online while installing and use my apple id, but this is not my iMAC, so I don't want to use my account.  Also, I am working in a building that will not allow me network access until I authenticate, which can't be done unless I open the browser first.  So I'm stuck at this point.  I can't even restore a time machine backup that I have because it gives the error message that the system encountered an error.  Any suggestions?

    Ask the admin/owner to sign in. 

  • Change the name of custom tab in me51n / me52n / me53n

    Hi,
    I have to add a few custom fields in PR item of  transactions me51n / me52n / me53n. I have used the enhancement MEREQ001 for adding the custom fields. The sytem automatically creates a custom tab with the name Customer Tab for the additional fields that I have added using the enhancement MEREQ001 while displaying in me51n / me52n / me53n.
    Now I have a requirement to change the name of the custom tab created for transactions me51n / me52n / me53n from Customer Data to Others.
    Can anyone suggest me how to go about doing this???
    Thanks in advance.
    Abhisek.
    P.S.:- Points will be be duly awarded 4 helpfull answers.

    Hi,
    I tried doing whatever you had suggested but it seems that it is not working.
    Could you suggest some other way to do this?
    Thanks and regards.
    Abhisek.

  • How do I change the name I have called my MacBook Air so I can add 11" and 13" into the title of whose computer this is for more clarity when I set up Time Machine and save to it with both computers?  Both are named with "my name and MacBook Air"

    I'm still learning the whole Mac thing but these are great machines!  I purchased a MacBook Air 13" and then thought I should also get a MacBook Air 11" for travel.  When I set it up at the Apple store I told the assistant the exact same name for each machine, i.e., "my name and MacBook Air."  What I want to do is go back in and rename both of them adding the 11" and 13" designation to the name so that when I set up Time Machine or whatever else I know exactly which machine is what.  I'm sure it is very simple but I cannot seem to figure it out.  Help please. Thanks.

    Go to System Preferences - Sharing and change the computer name there. You can also, optionally, change the name of your hard drive to further clarify the origin of your backups. Click once on the "Macintosh HD" on your desktop, then click its name to allow you to edit it.
    Matt

  • How can I change the names of catagories that have been added to my music library?  Is it possible to change names or artists or gendre and how to do it?

    How do I change the names of artists or gendre in the itunes list after importing an album?  Is it posssible to change that information?

    Yes. Select one or more tracks (use ctrl or shift clicks to add/remove or extend a selection) then right-click or press CTRL-I to Get Info. Use the different tabs of the dialog to make changes.
    For general advice on getting things neat & tidy see my article on Grouping tracks into albums.
    tt2

  • I have two iphone 4's with the same name on one computer.  Can I change the name of one so that I can sync each phone separately

    I have two iphone 4's with the same name on one computer.  Can I change the name of one so that I can sync contacts separately?

    How to rename your device in iTunes

  • How can I change the name of my home directory?

    When I first set up my Macbook Pro a year ago, I put my first and last name. I didn't like this and later changed the login name to just my first name, but the "home" directory is still listed as my full name on the side panel in Finder windows. How can I change this, it won't let me rename that.

    Barney-15E wrote:
    You should have experienced that same effect when you managed to change you login name. How did you change your login name?
    I imagine that has something to do with why everything 'disappeared' when you changed the directory name.
    It's actually pretty simple to change the login name, and it doesn't affect files at all.
    All I did was change the field labeled "user name".
    Niel wrote:
    Move all of your files to the other home folder in the Users folder and then change the name.
    (38519)
    I'll try that, thanks.

  • How can I change the name of my ipod touch?

    I want to change the name of my ipod touch so that it shows up in itunes as a different name than it currently does. How do I do this or is it not possible?

    No you don't!
    Go to Settings >Genreal> About>Name.  Next to this you should see the existing name.Just click and type!

  • How can I change the name of item in TableViewController iOS

    How can I change the name of item in TableViewController? I want to be able to change the title of an item if I added one. Code:
    //  ViewController.m
    //  Movie List
    //  Created by Damian on 20/02/15.
    //  Copyright (c) 2015 Tika Software. All rights reserved.
    #import "ViewController.h"
    @interface ViewController ()
    These outlets to the buttons use a `strong` reference instead of `weak` because we want
    to keep the buttons around even if they're not inside a view.
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *editButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *cancelButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *deleteButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
    // A simple array of strings for the data model.
    @property (nonatomic, strong) NSMutableArray *dataArray;
    @end
    #pragma mark -
    @implementation ViewController
    - (void)viewDidLoad
        [super viewDidLoad];
         This option is also selected in the storyboard. Usually it is better to configure a table view in a xib/storyboard, but we're redundantly configuring this in code to demonstrate how to do that.
        self.tableView.allowsMultipleSelectionDuringEditing = YES;
        // populate the data array with some example objects
        self.dataArray = [NSMutableArray new];
        NSString *itemFormatString = NSLocalizedString(@"Movie %d", @"Format string for item");
        for (unsigned int itemNumber = 1; itemNumber <= 0; itemNumber++)
            NSString *itemName = [NSString stringWithFormat:itemFormatString, itemNumber];
            [self.dataArray addObject:itemName];
        // make our view consistent
        [self updateButtonsToMatchTableState];
    #pragma mark - UITableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        return self.dataArray.count;
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateDeleteButtonTitle];
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateButtonsToMatchTableState];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        // Configure a cell to show the corresponding string from the array.
        static NSString *kCellID = @"cellID";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
        cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
        return cell;
    #pragma mark - Action methods
    - (IBAction)editAction:(id)sender
        [self.tableView setEditing:YES animated:YES];
        [self updateButtonsToMatchTableState];
    - (IBAction)cancelAction:(id)sender
        [self.tableView setEditing:NO animated:YES];
        [self updateButtonsToMatchTableState];
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
        // The user tapped one of the OK/Cancel buttons.
        if (buttonIndex == 0)
            // Delete what the user selected.
            NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
            BOOL deleteSpecificRows = selectedRows.count > 0;
            if (deleteSpecificRows)
                // Build an NSIndexSet of all the objects to delete, so they can all be removed at once.
                NSMutableIndexSet *indicesOfItemsToDelete = [NSMutableIndexSet new];
                for (NSIndexPath *selectionIndex in selectedRows)
                    [indicesOfItemsToDelete addIndex:selectionIndex.row];
                // Delete the objects from our data model.
                [self.dataArray removeObjectsAtIndexes:indicesOfItemsToDelete];
                // Tell the tableView that we deleted the objects
                [self.tableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationAutomatic];
            else
                // Delete everything, delete the objects from our data model.
                [self.dataArray removeAllObjects];
                // Tell the tableView that we deleted the objects.
                // Because we are deleting all the rows, just reload the current table section
                [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
            // Exit editing mode after the deletion.
            [self.tableView setEditing:NO animated:YES];
            [self updateButtonsToMatchTableState];
    - (IBAction)deleteAction:(id)sender
        // Open a dialog with just an OK button.
        NSString *actionTitle;
        if (([[self.tableView indexPathsForSelectedRows] count] == 1)) {
            actionTitle = NSLocalizedString(@"Are you sure you want to remove this movie?", @"");
        else
            actionTitle = NSLocalizedString(@"Are you sure you want to remove these movies?", @"");
        NSString *cancelTitle = NSLocalizedString(@"Cancel", @"Cancel title for item removal action");
        NSString *okTitle = NSLocalizedString(@"OK", @"OK title for item removal action");
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionTitle
                                                                 delegate:self
                                                        cancelButtonTitle:cancelTitle
                                                   destructiveButtonTitle:okTitle
                                                        otherButtonTitles:nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
        // Show from our table view (pops up in the middle of the table).
        [actionSheet showInView:self.view];
    - (IBAction)addAction:(id)sender
        [self.dataArray addObject:@"New Movie"];
        // Tell the tableView about the item that was added.
        NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForRowself.dataArray.count - 1) inSection:0];
        [self.tableView insertRowsAtIndexPaths:@[indexPathOfNewItem]
                              withRowAnimation:UITableViewRowAnimationAutomatic];
        // Tell the tableView we have finished adding or removing items.
        [self.tableView endUpdates];
        // Scroll the tableView so the new item is visible
        [self.tableView scrollToRowAtIndexPath:indexPathOfNewItem
                              atScrollPosition:UITableViewScrollPositionBottom
                                      animated:YES];
        // Update the buttons if we need to.
        [self updateButtonsToMatchTableState];
    #pragma mark - Updating button state
    - (void)updateButtonsToMatchTableState
        if (self.tableView.editing)
            // Show the option to cancel the edit.
            self.navigationItem.rightBarButtonItem = self.cancelButton;
            [self updateDeleteButtonTitle];
            // Show the delete button.
            self.navigationItem.leftBarButtonItem = self.deleteButton;
        else
            // Not in editing mode.
            self.navigationItem.leftBarButtonItem = self.addButton;
            // Show the edit button, but disable the edit button if there's nothing to edit.
            if (self.dataArray.count > 0)
                self.editButton.enabled = YES;
            else
                self.editButton.enabled = NO;
            self.navigationItem.rightBarButtonItem = self.editButton;
    - (void)updateDeleteButtonTitle
        // Update the delete button's title, based on how many items are selected
        NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
        BOOL allItemsAreSelected = selectedRows.count == self.dataArray.count;
        BOOL noItemsAreSelected = selectedRows.count == 0;
        if (allItemsAreSelected || noItemsAreSelected)
            self.deleteButton.title = NSLocalizedString(@"Delete All", @"");
        else
            NSString *titleFormatString =
            NSLocalizedString(@"Delete (%d)", @"Title for delete button with placeholder for number");
            self.deleteButton.title = [NSString stringWithFormat:titleFormatString, selectedRows.count];
    @end

    Hey JB001,
    Sounds like you have more going on than just a simple issue with Home Sharing and more dealing with Wi-Fi syncing. Start with the article below and see if that may resolve it.
    iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi syncing
    http://support.apple.com/kb/TS4062
    If it does not work out, then may I suggest contacting Apple for further assistance to walk you through it or just take that time that you were talking about to sort it out.
    Contact Apple Support
    https://getsupport.apple.com/GetproductgroupList.action
    Regards,
    -Norm G.

  • How do I change the name of my Apple ID and iCloud account?

    I want to change my Apple ID to a @me.com or a @apple.com account cause right now it's an ugly hotmail account.
    I did read this page: http://support.apple.com/kb/HE40. But it is not helping me.
    When I change my e-mail to my @me account it gives an error. So what account should I use? Do I have to make a new one?
    Tristan

    I already got an iCloud account which is named the same as my Apple ID but I want to change the name of it to another e-mail account from Apple. So I need a new e-mail addres. Where can I make a new e-mail account? When I've got a new e-mail addres then I will use that in stead of my hotmail account.

Maybe you are looking for