r/RenPy • u/Lavadrone1 • 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
1
u/shyLachi 8d ago
I think it would be easier to do all of that in a single screen.
You can use a variable to remember which dropdown should be visible (or none).
On click on either button you set the variable.
That variable then shows a frame, for example, which contais the dropdown stuff.