Home AMX User Forum NetLinx Studio
Options

Switch case within a hold statement

So I have a block of code that I am using below.. I am unable to activate anything within the hold portion of the button event. I just ended up writing a new button event for the 10 buttons that I have in this situation. Why is it though that it wouldn't work?

Thanks,
Ryan



BUTTON_EVENT [dvTP,0]
{
PUSH:
{
SWITCH (BUTTON.INPUT.CHANEL)
{
CASE 1: { } //DO SOMETHING HERE
}
}
HOLD[20]:
{
SWITCH (BUTTON.INPUT.CHANEL)
{
CASE 1: { } //DO SOMETHING HERE
}
}
}

Comments

  • Options
    jjamesjjames Posts: 2,908
    The only thing I find odd, is doing a SWITCH..CASE on 0. Not sure if that's messing it up. I'm doing a SWITCH..CASE on a HOLD event in code right now, works fine. Try defining the BUTTON_EVENT's channels. Please report back.

    Note: Just to clarify, I *do* know that BUTTON_EVENT[dvTP,0] is perfectly legal.
  • Options
    pauldpauld Posts: 106
    The way I understand BUTTON_EVENT[dvTP,0] is that Push: and Release: are valid but Hold: is not valid.

    Pauld
  • Options
    ryanwwryanww Posts: 196
    Oh, I guess if I used a devchan or chan array, it probably would have worked. Its only a couple buttons, so I am not too worried.. Just wondering though..

    Thanks,
    Ryan
  • Options
    JeffJeff Posts: 374
    did you copy/paste direct from your code? Because you're trying to act upon button.input.chanel, instead of button.input.channel

    J
  • Options
    ericmedleyericmedley Posts: 4,177
    Whoops, I thought you were talking to me... I removed my message explaining my misspelling. However, I then found I had spelled it correctly and you were speaking to someone else.
  • Options
    ericmedley wrote:
    Whoops, I thought you were talking to me... I removed my message explaining my misspelling. However, I then found I had spelled it correctly and you were speaking to someone else.
    Hope you didn't say anything mean to Jeff in your pre-deleted post. You might find one of those interdiction Coast Guard gunboats near your offices :).

    --John
  • Options
    ericmedleyericmedley Posts: 4,177
    Hope you didn't say anything mean to Jeff in your pre-deleted post. You might find one of those interdiction Coast Guard gunboats near your offices :).

    --John

    No, there was nothing mean at all. I actually made a self-depricating joke but then realized that it wasn't directed at me in the first place. So, the joke would then not make sense.
  • Options
    Not just one bug

    The results of some research using an NI700 on v2.29.218 and NS2 on 2.5.0.163 with a G3 browser panel emulating a touchpanel and also using "Emulate a Device".

    Here is the code that illustrates the problem:
    program_name='fred'
    
    define_device
    
    dvTP = 10810:1:0
    
    define_event
    
    button_event [dvTP,0]
      {
      push:
        {
        send_string 0,"'push[',itoa(button.input.channel),']'"
        }
      hold[10]:
        {
        send_string 0,"'hold[',itoa(button.input.channel),']'"
        }
      }
    

    The push is fine but the hold sees a value for button.input.channel of 0.

    If I push twice within a second, I see an error message on the NI telnet:

    "CIpHold::AddHold - Duplicate"

    I see a single hold after every push no matter how brief the push.

    If I change to
    button_event [dvTP,164]
    

    everything is OK.
  • Options
    ryanwwryanww Posts: 196
    Yea.. that was just my horrible spelling cuz I was in a hurry.. That wasn't copy and pasted.

    But that is what I did.

    Thanks, Ryan
Sign In or Register to comment.