button reacts on both up and down
  • Donleavy
    member
    Posts: 38
    Joined: Fri Mar 11, 2005 6:01 pm

    button reacts on both up and down

    by Donleavy » Fri Oct 07, 2005 11:38 pm

    Hey there

    I am trying to make a module with a button for the next media and a button for the previous media in the mediasets. The module is pretty simple, but the buttons keep reacting on both down and up. I have set the down value of the button to 1 and the up value to 0, but it doesn't seem to help. The only way I can get it to work is to set the button to "toggle". But it isn't really a toggle button...

    What am I doing wrong ?

    I upload the module to the public library for you to inspect: Previous+Next
  • User avatar
    yves@garagecube
    master
    Posts: 695
    Joined: Mon Jun 28, 2004 5:50 pm
    Location: Geneva
    Contact:

    by yves@garagecube » Sat Oct 08, 2005 12:53 pm

    You should check the "param" dictionary sent with the message.

    Typically you receive a value in the param, 1.0 for down and 0.0 for up.

    For example

    Code: Select all

    if param['value']==1.0:
         print 'button is down'
    elif param['value']==0.0:
         print 'button is up'



    If you want to see the parameter that you receive simply print the param dictionary and check the result in the console:

    print param

    result for down is:

    {'NAME': 'Untitled', 'value': 1.0}

    result for up is:

    {'NAME': 'Untitled', 'value': 0.0}

    NAME is the name of your control.
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Sun Oct 09, 2005 8:54 am

    ok, but what about if we want to deactive the up value (I have the same problem but it doesn't really change my module but that would be better ;))

    can we do something like that?

    Code: Select all

    if param['value']==0.0:
          param['value']==nil


    nil or something similar... I don't know :roll: :wink:

    thanks
  • User avatar
    yves@garagecube
    master
    Posts: 695
    Joined: Mon Jun 28, 2004 5:50 pm
    Location: Geneva
    Contact:

    by yves@garagecube » Sun Oct 09, 2005 12:22 pm

    Not sure what you mean by "deactiving" a value. If you are not interested by the up mouse event you can simply ignore it.
  • Donleavy
    member
    Posts: 38
    Joined: Fri Mar 11, 2005 6:01 pm

    by Donleavy » Sun Oct 09, 2005 2:12 pm

    Thanks for the answer.

    I simply put the "if param['value']==1.0:" into my script, and now it works. It looks like this:

    Code: Select all

     if msg == 'next' :
       if param['value']==1.0:
          val = modul8.getValue('ctrl_layer_media',0)
          newVal = val+1
          modul8.setValue('ctrl_layer_media', newVal,0)



    /Donleavy
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    by sigmasix » Sun Oct 09, 2005 10:43 pm

    :P I'm quite stupid :roll: I was thinking in the wrong way... :x :lol: Donleavy just opened my eyes :wink: thanks

Who is online

Users browsing this forum: No registered users and 9 guests