Home AMX User Forum AMX Technical Discussion

Multidimensional Structure What's Wrong With This Picture

I have my structure set up just like the example in the programming manual on page 175

I am trying to make a multidimensional structure

Here is my code

DEFINE_DEVICE
dvTP_1=128:1:1

DEFINE_CONSTANT
nAudioZoneMax=6 //Value To Say if room number is greater than nAudioZoneMax, it is a surround zone - Will equal the number of Audio zones
nTotalZoneMax=10 //Total number Of Zones
nAudioSourceTotal=6
INTEGER nBtnArray_RoomNav[]={3001,3002} //Array For Navigation Button Numbers
DEV dvAllTP[]={dvTP_1} //Array For Touchpanels
INTEGER nBtnArray_AudioZoneNav[]={2001,2002,2003}
INTEGER nBtnArray_SurroundZoneNav[]={2101,2102,2103}

DEFINE_TYPE

STRUCTURE _PanelStruct
{
INTEGER nRoomSelected //Keeps Up With What Room Which Panel Is On
}
STRUCTURE _AudioZoneStructure
{
CHAR cZoneName[50]

****HERE IS THE AREA OF QUESTION*****

_AudioZoneSourceStructure AudioSource[6]

INTEGER nZonePowerStatus
}

STRUCTURE _AudioZoneSourceStructure
{
INTEGER nPowerStatus
INTEGER nUseStatus
}
DEFINE_VARIABLE
//Room Navigation

INTEGER nRoomNavButtonFactor = 3000 //Value to subtract from the Button Press To get some factor
INTEGER nSurroundButtonFactor= 2000
INTEGER nAudioZoneButtonFactor= 2100
INTEGER nPanelNum
INTEGER nRoomVar
_PanelStruct Panel[1]
INTEGER SourceInc //Value To Run Through Source Status To Do Button Feedback
_AudioZoneStructure AudioZone[nAudioZoneMax]
_AudioZoneSourceStructure AudioSource[nAudioSourceTotal]

DEFINE_LATCHING


DEFINE_MUTUALLY_EXCLUSIVE

DEFINE_START

DEFINE_EVENT
BUTTON_EVENT [dvAllTP,nBtnArray_RoomNav]
{
PUSH:
{
nPanelNum=GET_LAST(dvAllTP) //Gets Which Panel Press Came From
nRoomVar=GET_LAST(nBtnArray_RoomNav) //Gets Which Button Got Pressed
OFF[dvAllTP[nPanelNum],nBtnArray_RoomNav]
OFF[dvAllTP[nPanelNum],nBtnArray_AudioZoneNav] //Clear Button Status
OFF[dvAllTP[nPanelNum],nBtnArray_SurroundZoneNav] //Clear Button Status
Panel[nPanelNum].nRoomSelected=nRoomVar //Tells which room a particular panel has selected
IF(Panel[nPanelNum].nRoomSelected<nAudioZoneMax)
{
****BELOW IS ANOTHER THE AREA OF QUESTION*****

FOR(SourceInc=1;SourceInc<=nAudioZoneMax;SourceInc++)
{
[dvAllTP[nPanelNum],nBtnArray_AudioZoneNav[SourceInc]]=AudioZone[Panel[nPanelNum].nRoomSelected].AudioSource[SourceInc].nUseStatus
}
}
On[dvAllTP[nPanelNum],nBtnArray_RoomNav[nRoomVar]]
}
}



I am trying to update a source button status based on which source is in use in that given room.

When I Compile i get "left side of [.nUseStatus] must be a Structure Type."

It looks exactly like the manual's code to me...I dont know what is up..


Thanks

Rolo

Comments

  • STRUCTURES are fun

    Rolo,

    Two things:

    1. To fix the compile error, simply move the structure definition for STRUCTURE _AudioZoneSourceStructure before the structure definition for STRUCTURE _AudioZoneStructure. The compiler seems to have a bit of a forward reference problem in this case. Defining the embedded structure prior to its declaration and use in the second structure fixes the compile problem.

    2. The independent declaration of _AudioZoneSourceStructure AudioSource[nAudioSourceTotal] (just prior to the DEFINE_LATCHING section) seems redundant and is probably not what you want since AudioSource is also an array embedded within one of your structures. Best case, it is confusing. Worse case, it is not needed.

    Hope this helps.

    Reese
Sign In or Register to comment.