[SOLVED] How to make drags disappear after clicking a button?
Posted: Tue Mar 12, 2024 11:20 pm
Hi all, I'm currently working on an in-game computer where each "app" is its own screen within. I have them set up as drags like so:
Each drag uses a screen with a window and its own functionality. There's also a close button:
This set up works for the most part and I'm able to open the screens without any problems. The issue is that closing them doesn't work. When I click on the close button, all the button text just turns white for some reason and the screen stays. I can still interact with the screen normally. The reason I have it set up like this instead of purely putting unique drags within the screens instead is that I wanted certain behaviors like drag_raise, thus requiring them all to be within the same drag group. If anyone has a better idea in mind, I'm all ears but that's what I have for now.
Code: Select all
screen desktop():
.....
######## Desktop Icons ##########
....
# Chatrooms
imagebutton:
at transform:
pos (330, 150)
auto 'images/desktop browse/home/chatroom_icon_%s.webp' focus_mask True
action ToggleVariable("chatrooms_open", "True")
# Area to put all draggable windows in
fixed:
pos(190, 75)
xysize(1500, 750)
# Put all screens in this one group
draggroup:
...
if chatrooms_open:
drag:
draggable True
drag_raise True
use chatrooms
...
Code: Select all
screen chatrooms():
....
textbutton "close":
action [SetVariable("chatrooms_open", "False")] # I also tried hiding the screen but that didn't work either
xalign 1.2 yalign -0.2