Changing an MSMatrix object

Discussion in 'Mac Programming' started by arjena, Oct 13, 2012.

  1. arjena macrumors newbie

    Joined:
    Jan 28, 2010
    #1
    I'm trying to change the user interface of a project found on Sourgeforge (control panel for the velleman K8055 USB interface kit). The element I want to change is a matrix object of 8 check boxes. Now they are set in a 2-row 4-column arrangement, I want them in one column so I can add meaningful labels in stead of 1, 2, 3 etc. But when I change the layout I seem to loose the functionality of the buttons. When I make a new set of buttons (make one, embed in matrix, hold alt and drag till I have eight) en link the MSMatrix object like the original one was linked only two buttons work: the first and the last, corresponding to the first two buttons in functionality. I must be missing something...
    To a seasoned programmer this is probably obvious, but my programming skills are mainly limited to writing C code for PIC microprocessors. No GUI there.
    If all this does not sound too gibberish, can someone point me in the right direction?

    Thanks,

    Arjen
     
  2. arjena thread starter macrumors newbie

    Joined:
    Jan 28, 2010
    #3
    I had not, I have now. Thanks for the tip.
    But after reading this page I still don't know how to solve the problem. This sentence:

    An NSMatrix is like a spreadsheet; you can select a single cell or discontiguous group of cells regardless of row/column.

    makes me think it should work regardless whether I make the object 2 rows 4 columns or a singel column with 8 rows. But it does not, so I must be missing something...
    I'd be glad to attach my Xcode project but I'n not sure if that is allowed on this forum.
     
  3. arjena thread starter macrumors newbie

    Joined:
    Jan 28, 2010
    #4
    I read through the code (again) but all I can find is this on how the cells in the matrix are addressed:

    Code:
    for(count=0;count<8;count++)
    				[[pOutput cellWithTag:count] setEnabled:FALSE];
    Of course the cells are addressed more often, but always in this way. So I assume the cells must have an id (tag) from 0 to 8, but I cannot find how to attach an id to the cells. 'identifier' is set to automatic so shouldn't it just work?
     
  4. arjena thread starter macrumors newbie

    Joined:
    Jan 28, 2010
    #5
    I managed to get it working by replacing all occurrences of cellWithTag with cellAtRow: Column:. This was simple to do since I changed the matrix to one column with 8 rows. This was inspired by the page at cocoadev btw, so thanks again for that link.
    Being the curious type I still would like to know why cellWithtag did not work for the existing matrix, but not for the modified or new matrix.
     
  5. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #6
    At first blush, my guess is there were tags in the original matrix, and when you rearranged it you really created new cells, you didn't move the originals, including tags.

    -Lee
     
  6. arjena thread starter macrumors newbie

    Joined:
    Jan 28, 2010
    #7
    That's also my guess, it's just that I could not find any reference to any tag within the matrix. When I select a single cell it's identifier is set to Automatic and everything else seems to be default too.
    How/where do I find if and what tags are assigned to cells?

    Cheers,

    Arjen
     

Share This Page