Custom ui_buttons glitch out after touching other controls

superfunk
superfunk Member Posts: 4 Member

Hi Guys,

I've got a few custom buttons I'm trying to use in an instrument. If the buttons are in an off state, (value 0) and I move another knob on the instrument the button graphics will get chopped and only show a portion of the top of the button until I click it again. They don't glitch out if they are in an On state.


   declare ui_button $BrassB
   set_control_par(get_ui_id($BrassB),$CONTROL_PAR_DEFAULT_VALUE,1)
   set_control_par_str(get_ui_id($BrassB),$CONTROL_PAR_PICTURE,"Brass88")
   set_control_par_str(get_ui_id($BrassB),$CONTROL_PAR_TEXT,"")
   set_control_par(get_ui_id($BrassB),$CONTROL_PAR_WIDTH,89)
   set_control_par(get_ui_id($BrassB),$CONTROL_PAR_HEIGHT,145)
   move_control($BrassB, 2, 9)
   make_persistent($BrassB)


Any suggestions?

Thanks for looking.

Answers

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    edited March 2022

    How does your .txt file look? Try setting horizontal and vertical resizability to "yes" (even if the button is not resizable).

  • superfunk
    superfunk Member Posts: 4 Member

    Here is what the .txt looks like with resizable changed to yes for both vertical and horizontal. (with blank 10th line)

    Has Alpha Channel: yes 
    Number of Animations: 6
    Horizontal Animation: no
    Vertical Resizable: Yes
    Horizontal Resizable: Yes
    Fixed Top: 0
    Fixed Bottom: 0
    Fixed Left: 0
    Fixed Right: 0
    
    


    Thanks for the ideas. It still glitches out if the button is in off state and turning another knob. Would it have something to do with setting the Control Default Value? I added that line in order to get the button to display properly initially.

  • superfunk
    superfunk Member Posts: 4 Member

    Okay just following up on this. After trying different things out it seems as though the issue had something to do with using move_control() vs using $CONTROL_PAR_POS_X and Y. After fussing with this all morning feels good to find a fix that works. Maybe there was an error in the way I was originally using ui_button in conjunction with move_control. Thanks for looking and the help @EvilDragon.


    I also changed the code from a button to a switch so that it could be automated. Here is some working code if it helps anyone else who stumbles onto this issue.


       declare ui_switch $brass_switch
       set_text ($brass_switch,"")
       declare $brass_switch_id
       $brass_switch_id:= get_ui_id ($brass_switch)
       set_control_par_str ($brass_switch_id,$CONTROL_PAR_PICTURE,"Brass88")
       set_control_par ($brass_switch_id,$CONTROL_PAR_WIDTH,90)
       set_control_par ($brass_switch_id,$CONTROL_PAR_HEIGHT,146)
       set_control_par ($brass_switch_id,$CONTROL_PAR_POS_X,15)
       set_control_par ($brass_switch_id,$CONTROL_PAR_POS_Y,200)
    


  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod

    If you want to automate a button, use ui_switch, not ui_slider!

    And yes, if you use pixels for width/height, you also need to use pixels for X/Y position, that's a must.

Back To Top