Don't get me wrong, I could switch that easily over to allow other panels to do stuff, this is just one of the ways I would do it. It is the easiest, and I don't know about you, but typically we don't have gobs of people running around setting their presets all at once, so it's not a problem
But, in true fashion of the forum, it seems to always be a debate of most efficient code rather than most practical, straight forward, or "easiest" code.
I have the same code on all the buttons (volume/channel/up/down/left/right etc) so it is something that occurs all the time. It isn't an obscure problem at all in my projects. I don't quite follow your code as there is no hold event. The user pushes a button and then there is a 3 second wait until something happens?\
I have a hold in my code and that's what I thought the discussion was about, using get_last with holds. If not, ignore my post
Paul
I was just posting a way Dan could have / might have done what he was doing. I think I was the one off topic. And yes, the whole volume thing when press and hold is needed, I use timelines for that, not the way I set presets (as shown in the snippet of code I posted.)
Many thanks for all the input. I've ready got someting working, but a other thing that also has been done for this project took to much time (programming a Alcorn Mcbride video binloop). So I finally give my reaction.
What I've programmed friday: The button event
BUTTON_EVENT[dvTPs,nVOLUME] //VOLUME CONTROL
{
PUSH:
{
LOCAL_VAR INTEGER nPNL
LOCAL_VAR INTEGER nEVENT
nPNL = GET_LAST(dvTPs)
nEVENT = GET_LAST(nVOLUME)
// Function layout
// fnVOLUME(MODE, TYPE,ID,DEVICE)
// MODE = Screen OR MLC
// TYPE = Volume up or down
// ID is the screen ID (only needed for a Philips screen, otherwise put in a zero: 0)
SWITCH (nPNL)
{
CASE 1: fnVOLUME(nEVENT,1,1)
CASE 2:
{
fnVOLUME(nEVENT,1,2)
fnVOLUME(nEVENT,1,3)
}
CASE 3: fnVOLUME(nEVENT,1,4)
CASE 4: fnVOLUME(nEVENT,1,5)
CASE 5: fnVOLUME(nEVENT,1,6)
CASE 6: fnVOLUME(nEVENT,1,7)
CASE 7: fnVOLUME(nEVENT,2,0)
}
}
HOLD[3,REPEAT]:
{
LOCAL_VAR INTEGER nPNL
LOCAL_VAR INTEGER nEVENT
nPNL = GET_LAST(dvTPs)
nEVENT = GET_LAST(nVOLUME)
SWITCH (nPNL)
{
CASE 1: fnVOLUME(nEVENT,1,1)
CASE 2:
{
fnVOLUME(nEVENT,1,2)
fnVOLUME(nEVENT,1,3)
}
CASE 3: fnVOLUME(nEVENT,1,4)
CASE 4: fnVOLUME(nEVENT,1,5)
CASE 5: fnVOLUME(nEVENT,1,6)
CASE 6: fnVOLUME(nEVENT,1,7)
CASE 7: fnVOLUME(nEVENT,2,0)
}
}
}
It is still choosing whats the best way of programming.
Next thursday I've got my first AMX training in Belgium... to give a good view what's my programming level
I almost give up when the project changed a little bit this afernoon and the affort of short programming has been reduced to minimal... so now i've found a workaround. I'm defining some more button events, so it will be around the 21 button events... it will be a lot quicker for me now to work like this then doing my best to short down all the code.
So what I posted this morning is already been undone....
But... I thanks everyone for giving his opinion about this
CONSTANT
This keyword is used as part of a variable declaration to specify that the variable cannot be changed at run-time. If a variable is declared with this keyword, it must be initialized in its declaration.
Comments
I have the same code on all the buttons (volume/channel/up/down/left/right etc) so it is something that occurs all the time. It isn't an obscure problem at all in my projects. I don't quite follow your code as there is no hold event. The user pushes a button and then there is a 3 second wait until something happens?\
I have a hold in my code and that's what I thought the discussion was about, using get_last with holds. If not, ignore my post
Paul
What I've programmed friday:
The button event
It is still choosing whats the best way of programming.
Next thursday I've got my first AMX training in Belgium... to give a good view what's my programming level
I give up . . .
I almost give up when the project changed a little bit this afernoon and the affort of short programming has been reduced to minimal... so now i've found a workaround. I'm defining some more button events, so it will be around the 21 button events... it will be a lot quicker for me now to work like this then doing my best to short down all the code.
So what I posted this morning is already been undone....
But... I thanks everyone for giving his opinion about this
I'm glad I don't use GET_Lasts
Concerning the subject of this thread....
Aren't all variables dynamic by nature?
One could also say 'Static Constants' too...
Not all variables are dynamic....
:P
Jeff