Multidimensional Structure What's Wrong With This Picture
rolo
Junior Member
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
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
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums