Does any one know a way to change the behavior of Matlab sliders so that they move directly to the value you click on?
For instance, lets say a slider is initialized at zero (far left side). I'd like to able to click anywhere on the slider (including the far right side) and have the slider instantly move to that location. The way they normally work you'd have to click repeatedly to move the slider over to the right side one increment at a time, or hold down the right arrow.
I am running an experiment where subjects need to assign values for 420 sliders! It would speed things up a lot of each slider only required a single click.
Thanks,
Related
In Unreal's blueprint, I want to use the right and left sides of the UI Canvas in different ways. This can happen separately, but it can also be used at the same time. While currently using the left drag, the drag event for the left calls the drop event the moment you press the right. Is there a way to maintain the drag event for the left even if you press the right side while using the left drag?
You can make two different onDrop arena ;; you can make 1 and pick function based on drop position using pointer event ;; you can use in smart way onDrop run priority or you can make other way.
I am building an app with the App Designer. The figure includes multiple plots that are synced. I would like to make something to scroll through the plots so that I can show a set amount of time at any given time. As it is now, it includes the ability to pan and zoom with just mouse controls. I cannot find a way to make such a scroll bar.
I was thinking of using the slider tool to keep re-plotting the plot based on where the slider begins, but that solution is very messy. And it could lead to some data never appearing.
Even if I could just make some way for me to set the plot to just show a given x interval (say 100 units of time) and use a key press to go to the next x interval without skipping anything.
Any help would be greatly appreciated!
I am trying to make a multiple choice quiz in Scratch, but I am having trouble with coding the buttons. I have created the buttons, but I do not know how to get them so the users can click on them to choose answers. How can I get them to work?
Here is a screenshot of the code and the actual quiz.
You're currently using the TOUCHING SPRITE block. This block is for when the sprite itself is touching another sprite.
If you go into the code for each button, you'll find a hat block: WHEN THIS SPRITE CLICKED.
You can take this block, and have it set a variable with which block was clicked.
So in each of the button sprites you'd have something like this:
WHEN THIS SPRITE CLICKED
SET (ANSWERSELECTED) TO [A]
Then in your person sprite, where you currently have TOUCHING SPRITE 2 etc, you can have a variable that contains the answer selected. You'll want to clear the variable each time a new question is asked, e.g., set it to blank.
So you'll end up with something like this:
That's probably the simplest way.
IIRC, if you don't want to put scripts in the button sprites, you can also hack something together with something like IF MOUSE DOWN AND MOUSE X = (here you'd need to hack together the location of the button, probably using a AND block and using the X location of the button on both ends (which you can find using the mouse, under the player shows the current X and Y positions of the mouse)) AND MOUSE Y = (same as with X) SAY CORRECT FOR 3 SECS, but that's more difficult.
(That will require that the mouse be on the exact center of the button, though, so if you want to do it that way you'll probably want to account for being slightly off the center.)
To see what I mean excatly please:
Run the code below
figure
plot(peaks)
cameratoolbar('SetMode','orbit');
cameratoolbar('Show');
Move mouse onto the plot. Hold down the left click, move the mouse to left ot right then release the click. You'll see the plot start sniping for ever.
Now if you click on the red, stop sign button it stops from spinning. However I would like to programmatically stop the spinning plot. Any thoughts?
Opening cameratoolbar in the editor reveals that orbiting is accomplished by setting the figure's WindowButton* callbacks temporarily to nested/sub functions within cameratoolbar.
Judging from the 1-minute diagonal read-through I did, the camera orbit itself is accomplished by calling a pan/zoom function orbitPangca, which recursively calls cameratoolbar. This recursion loop is controlled by flags which are toggled by the callbacks from the toolbar buttons. These flags alter the behaviour of each iteration in the recursion loop.
If this is indeed the case, it would imply that Matlab is not accepting commands from any source you have programmatic control over, while the plot is orbiting. It'll only respond to the button presses. This means that if you want to stop the motion programmatically, you'd have to hack cameratoolbar to allow for this - not the most portable option.
Another idea that just popped to mind, is figuring out which WindowButton* callback is used for the orbit, and define your own function there. You might just be lucky enough that the MathWorks implemented cameratoolbar such that both callbacks are called each iteration, which would give you programatic control over the flags. But -- you'd have to test this yourself.
In gamesalad framework I am creating a game in which I have an actor which only moves on x-axis on touch is pressed. But when I move it to x-axis the actor goes away out of the range of the screen. Let me clarify that I am new to gamesalad framework.
plz help to solve the problem.
I'm reading this in two different ways:
1 - when you press your touch controls the actor disappears from the screen
2 - when you press the touch control the actor moves along the x-axis and out of the screen
For the sake of argument I'm going to assume that we're talking about number two.
What you'll need to do is restrict the actors movement to the boundaries of the current screen. You can do this is two ways with Gamesalad
1 - create an invisible barrier for your actor to collide against
2 - use a behaviour to prevent your actor from going beyond the screen boundary
I'll explain both:
1, Invisible barriers
What you'll do is create a new actor, and set it to collide with the actor that your controlling. You'll create a few instances of this actor to create a walled area for your actor. Although this works, it's a little cludgy and using additional actors in a scene take a little performance away from your application.
2, using a behaviour
In my opinion the better way is to use the given behaviours in Gamesalad itself.
To stop the player actor from moving off screen you can use a combination of Rules and the Constrain Attribute behaviour to achieve this.
The first thing to know is your screen size; for an iPad I believe it's 1074 along the x-axis.
So to stop the actor moving off either side of the screen you'll need to do the following:
Open up the player actor
the click on the "Create Rule" button on the top right.
A new rule window will appear, but default the first dropdown will say "Actor receives event" change this to "Attribute".
Next select the attribute to use the rule against, since we're interested in the x-axis we'll want to query that player attribute which will be:
(also known as self) > Position > X
Select the greater than symbol (">") and then enter the maximum width of the screen minus whatever border value you want, so I'll use 1014 (1024 - 10).
Find and drag the Constrain Attribute behaviour into your rule a set the actors X position to 1014.
This will stop the actor from going beyond one side of the screen, now copy the rule and amend the settings to that if the actor goes less than, say 10, it will constrain the actors X position to 10.
I'd post an image, but alas my Karma isn't large enough right now! Hence the large explanation!
Hope this is what you're looking for!
It is way easier than that.
In top of the Gamesalad Creator there is a play button, which you probably know, displays your progress. To the left of this button there is a button that looks like a little video camera, it changes the camera settings. So what you first have to do is click the camera button, then the rectangular camera screen will show itself as marked. In the center of each of the sides of the highlighted rectangular which is the camera screen, sits 1 little grey rectangular. Each of these needs to be pulled to the center of the camera view so that you get a little grey "cross" in the center and from the center to the boarder there will now be this highlighted color.
Second and last step is easy, just go under your character and in (type or drag in a behavior block) you type control camera... or drag the control camera block, which as by the type box is statet possible.
Since Gamesalad only can have one camera at a time, and you character is the only one with the control camera option applied it will follow him and only him. Wherever your character starts on the screen, the camera will follow it when it passes through the center of the screen. You may know this from Super Mario Bros. Where you start of a little to the left and walk right and the second Mario enters the center of the screen, the camera follows him from then on.
Hope this helps... :