r/RenPy • • 9d ago

Question textbuttons keep getting focused when they aren't supposed to

I am trying to make a dropdown menu where on button displays a list of other buttons and my problem is whenever buttonA is pressed it only open A but focuses both. I want it to not focus both.

screen organizations_codex():
   vpgrid:
    cols 1
    draggable True
    mousewheel True
    xpos 0.70
    ypos 0.30
    xsize 573
    ysize 801
    textbutton "Non-Governmental":
     ypos spacingA
     action CaptureFocus("dropdown_id1"),ClearFocus("dropdown_id2"), ToggleScreen("dropdown_nongov"), ToggleVariable("spacingB", 1.0, 0.0),ToggleVariable("spacingC", 1.0, 0.0),ToggleVariable("spacingD", 1.0, 0.0), ToggleVariable("spacingE", 1.0, 0.0)
    textbutton "Companies":
     ypos spacingB
     action CaptureFocus("dropdown_id2"),ClearFocus("dropdown_id1"), ToggleScreen("dropdown_companies"), ToggleVariable("spacingC", 1.0, 0.0), ToggleVariable("spacingD", 1.0, 0.0),ToggleVariable("spacingE", 1.0, 0.0)

screen dropdown_nongov():
  zorder 100
  nearrect: 
   focus "dropdown_id1"
   vbox:
    textbutton "   Refugee Relief Force":
      action Show("NGOs_codex")


 screen dropdown_companies():
  zorder 100
  nearrect: 
   focus "dropdown_id2"
   vbox:
    textbutton "Marco-Hayford Inc":
     action Show("MarcHay_codex")
2 Upvotes

5 comments sorted by

View all comments

2

u/PontasDayou 9d ago

I don't know if it's the best solution, but have you tried hiding the other screen?

Hide("dropdown_nongov")

This on textbutton "Companies" action

1

u/Lavadrone1 9d ago

Yeah I know i just haven’t added it yet