1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Solved Correct way to position ui_panel?

Discussion in 'Scripting Workshop' started by Reid115, Oct 22, 2021.

  1. Reid115

    Reid115 NI Product Owner

    Messages:
    40
    I'm having trouble placing ui_panels. Here is my code:
    Code:
    on init
        set_ui_height(10)
      
        declare ui_panel $test_panel
        move_control($test_panel, 1, 2)
    
        declare ui_knob $test_knob (0, 100, 1)
        set_control_par(get_ui_id($test_knob), $CONTROL_PAR_PARENT_PANEL, get_ui_id($test_panel))
      
        declare ui_panel $dnd_panel
        move_control($dnd_panel, 1, 6)
      
        declare ui_waveform $dnd_wf (4, 2)
        set_control_par(get_ui_id($dnd_wf), $CONTROL_PAR_PARENT_PANEL, get_ui_id($dnd_panel))
    end on
    
    And here's the result:
    [​IMG]

    The knob is showing up to the right but it's supposed to be all the way on the left. The KSP manual doesn't speak much about this. Any help?
     
  2. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    move_control($test_knob,1,1)
     
  3. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    I'd use move_control_px instead of move_control, then it should work. Panels can be a bit buggy sometimes...
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yes just use pixel positioning.
     
  5. Reid115

    Reid115 NI Product Owner

    Messages:
    40
    This moves the knob to the left but then moves the waveform to the right.

    Pixel position works, thanks guys.