Variable Variable?

  • I would like to dynamically register an array of hotkeys by iterating
    through an array of user defined values where the variable "keyID"
    would be appended by the enumeration count (ie keyIdi: where i=counter+
    +).

    int i = 0;
    for(;i<[array count];i++){
        // Set name of *keyID* dynamically
        EventHotKeyID        keyID      = { 'hotK', i+1 };
        RegisterEventHotKey([[array objectAtIndex:i] intValue], nil,
    keyID,GetApplicationEventTarget(), 0, &eventHotKeyRef[i] );
        i++;
    }

    How is this accomplished?

    Thank you,
    Rich
  • --- Richard Salvatierra <richsal...> wrote:

    > I would like to dynamically register an array of
    > hotkeys by iterating
    > through an array of user defined values where the
    > variable "keyID"
    > would be appended by the enumeration count (ie
    > keyIdi: where i=counter+
    > +).

    It sounds to me like you want an array.

    Cheers,
    Chuck

          ____________________________________________________________________________________
    Looking for last minute shopping deals?
    Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
  • On Jan 16, 2008 7:05 AM, Richard Salvatierra <richsal...> wrote:
    > I would like to dynamically register an array of hotkeys by iterating
    > through an array of user defined values where the variable "keyID"
    > would be appended by the enumeration count (ie keyIdi: where i=counter+
    > +).
    >
    > int i = 0;
    > for(;i<[array count];i++){
    > // Set name of *keyID* dynamically
    > EventHotKeyID        keyID      = { 'hotK', i+1 };
    > RegisterEventHotKey([[array objectAtIndex:i] intValue], nil,
    > keyID,GetApplicationEventTarget(), 0, &eventHotKeyRef[i] );
    > i++;
    > }
    >
    > How is this accomplished?

    How is what aspect accomplished? The code you posted looks to be what
    you need (assuming C99 is used).

    -Shawn
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today