How do i make a functional button in scratch? - mit-scratch

I've been trying to make a button on scratch where if you press it once, it takes you to the help screen and if you press it again, it takes you back to the main menu. If anyone knows how to do this, please help! Thank you!

You could use two events. and you have everything on the help screen appear when one event happens, and hide when the other event occurs. Same with the main screen.
The code for the button would be something like this
when Green Flag clicked
go to front layer
forever
wait until mouse down and touching mouse-pointer
wait until not mouse down
broadcast msg1
wait until mouse down and touching mouse-pointer
wait until not mouse down
broadcast msg2
and for everything connected to the help screen,
when I receive msg1:
show
when I receive msg2:
hide
and for everything connected to the home screen,
when I receive msg2:
show
when I receive msg1:
hide

If you do not understand text for some reason:
Code for button:
Code for everything that is on main menu:
Code for everything that's on the home menu

Related

OnClick events starts on leaving the finger

is there a way to trigger onclick events by the on click and not by leaving the finger because the onclick event only triggers when you leave the finger from the button.
Thanks
These are some of the helper UI that I collected a long time ago and I don't remember the source of them
I uploaded it to github now
There is a script name is ( LeanButton )
From which you can choose OnClick or DownClick
Like Image
You can use the GetMouseButtonDown. https://docs.unity3d.com/ScriptReference/Input.GetMouseButtonDown.html
Or potentially GetMouseButton
https://docs.unity3d.com/ScriptReference/Input.GetMouseButton.html
Depending if you want your event to happen once on pressed or repeatedly while pressed.
OnClick is triggered on MouseUp after MouseDown on the same object.
You can use PointerDown() that is sent the first time a finger touches the screen or a mouse button is pressed.

How to wait until keyboard is raised in flutter?

I'm using the scroll to index
library here
(When I press the reply button of the comment, the scroll is moved to the comment area where I pressed the reply button.)
Pressing the reply button activates the keyboard, which becomes strange because it moves before the keyboard rises.
I want to wait for the keyboard to come up when I press the button and let it move when it comes up.
I've tried hasFocus, but it seems to be a solution that has nothing to do with this problem.
flutter_keyboard_visibility is same.
What should I do?

Make tvOS gamepad buttons send a message just once per physical press of a button

I am making an Apple TV game and am programming the settings screens. The problem I am running into is that the Nimbus gamepad is sending multiple button pressed messages when I press the button just once. I would really appreciate it if someone could tell me if there is a way to make the controller send only one button tapped message when the button is tapped just once. I mean I would like it is there was a way to have only one message generated after I press a button and release the button. Thanks very much.
Looking at the GameController docs:
https://developer.apple.com/documentation/gamecontroller/gccontrollerbuttoninput?changes=_2
Are you using pressedChangedHandler or valueChangedHandler? IIRC, the Nimbus has pressure-sensitive buttons so you should expect to receive continuously changing values when the button is pressed or released. pressedChangedHandler should only be called when isPressed is toggled.

Why does the click event listener break after the first click?

I'm using the angular-leaflet-directive within Ionic Framework. I set up a listener on a map marker and it works on the first click after the page is loaded. After that, though, it stops responding to the left mouse button (but confusingly still responds to the right mouse button).
Here's a demo. Any idea what's wrong?
I've got the same issue, use data-tap-disabled="true" in the tag leaflet worked to me.

how to do tooltip on button in iphone?

I am having download icon on my page i want that when the user takes his finger over the button a tooltip should show as showing download in text.
is there any option in iphone to show a tooltip???
Dan is absolutely right on how to do it but I'd answer you should rethink your design to not need the tooltip at all.
There's a reason that there isn't one by default - what if the user presses down on the button to see what it does, reads the tooltip and realises that's not what they want. They then have to be very careful not to let go while still over the button or it will press and do the wrong thing. (And most users don't know that they can press down over a button, move their finger off it and release it to cancel the press.)
You should rethink your design to make it obvious what the buttons do without the user having to interact with them first.
However, if you definitely still want a tooltip, Dan's method is fine.
Nothing built-in, no. If you think about it, generally a tooltip appears when you mouse over the target item. There's no "mousing over" with a touch interface.
You can definitely roll your own, though. Start by placing a view containing your tooltip contents exactly where you want it with an alpha of 0%. Make a custom button with no content that outlines your download icon, and hook its "touch down inside" action to a method that animates the tooltip view to an alpha of 100%. Hook your button's "touch up inside" , "touch down outside" and "touch up outside" actions (and maybe some others--you might want to experiment with that) to a method that animates the tooltip view back to an alpha of 0%.
There isn't native support for this in iOS. But you can create your own.
I ended up creating my custom tooltip/popover class.
Can be initalised with any content view and dynamically adjusts it's frame.
Hope it helps.
https://github.com/akeara/AKETooltip