SliderExtender Reset - ajaxcontroltoolkit

I would think this would be simple... or that atleast someone else would desire the same thing, but I am unable to find any documentation anywhere...
I have a form with 7 text boxes and 5 sliderextenders on 5 of them... im using jquery, and a client side input button to reset the form on the client side... i can reset the values of the text boxes easily, but the sliderextenders will not reset to their default position or their "actual" value... any ideas?

omg.. pretty easy actually.
function ResetForm() { $find('behaviorID').set_Value(0); }

Related

I need to create a Script in Unity 3D that change the text when I click a key button (1,2,3,4), then the text change

Example: A NPC greet you, and you have multiple choises that are questions for the NPC and if you want to know one answer of this questions, you click one button (1,2,3,4). Then the text change and give you the answer of the question.
I'm going to assume you have already set up your GUI and NPC Script.
Getting when a key is pressed is pretty simple in Unity: Use UnityEngine.Input
Example of use:
if(Input.GetKeyDown(KeyCode.Alpha1)) {
//do something
}
This is a basic example.
Input.GetKeyDown returns true only when the key is pressed at that specific moment of checking (the frame). KeyCode.Alpha1 is the key for '1' at the top of alphanumeric keyboards.
To get when the key is held down, for jumping or running, use Input.GetKey instead. This will be true if the key is held down at that instance, instead of only one at the beginning.
To get when the key is released, use 'Input.GetKeyUp'. This only runs once the key is let go.
For setting the color of a Textbox, use yourTextBox.color. I believe it works with both legacy Textboxes and TextMeshPro.
The way to do what you have is this:
In the Update call, check if an NPC is talking with the player.
If so, then check if the player has pressed 1 ,2, 3, or 4, using Input.GetKeyDown. (To make it nicer looking, have each option in a list and use the index of the result. KeyCode is an enum, so you can save it like any other variable.)
Call some function that returns the response to the answer. Return a string or something.
Override the text in the Textbox with the answer, and use yourTextBox.color to set the color as you wish.
This should cover it. I may have some typos or errors, but the basic principals should work. Also, make sure you implement it in a way that makes it easier to edit later. You don't want to write code that can't be added on later, trust me...

Making autocomplete work with touchscreen keyboard

I'm using complete.ly for a site intended for use on a touchscreen. The keyboard only appears on-screen if the selected element is a textfield or input, the code for that is:
if( (this.input_target.is('input') || this.input_target.is('textarea')) && this.input_target.parent().find('.popover').length == 0)
Is there anyway you guys can think of that I can either change the keyboard logic to include the div that complete.ly is using, or maybe change complete.ly to make this work?
I guess a better way for me to ask this would be if there is any way to detect when complete.ly's text box has focus.
I am not sure I understand the original question but I do understand your last comment:
I guess a better way for me to ask this would be if there is any way to detect when complete.ly's text box has focus.
well, there is a way to see when completely's text box (input type) has focus.
if you look at the documentation it says:
// For no-big-deal hacking
c.wrapper
c.prompt
c.input
c.hint
c.dropDown
so you can access the input and do something like this:
if (c.input.addEventListener) {
_c.input.addEventListener("focus", yourHandlerFunction, false);
}
else {
_c.input.attachEvent("onfocus", yourHandlerFunction);
}

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).

HTML DOM Drag and Drop

Yes, this may sound like a frequent question, but Google nor stackoverflow are giving me the answer that I want. I did stumble upon a few results on the WWW, but only found HUGE scripts for just this 1 piece of functionality.
The thing is, I remember doing this before, but I don't exactly remember how. I did it within ONE function and by adding event listeners and stuff along those lines.
Basically, I need a pure DOM script to drag and drop HTML elements for a throwback to older web browsers that don't support the new HTML5 standards. Must be down with the even 'onmousedown', and the text/image must be held for at least 1.5 seconds before calling the dragging.
Thoughts and ideas? Help would be greatly appreciated, guys.
I'm also a bit rusty with screen coordinates and stuff. With this code I want the text to follow the cursor EXACTLY. Not be like, 5 pixels "off" if you know what I mean.
What I had before (parameter of moveText is supposed to be an HTMLDivElement and it's innerText):
function moveText(t){
var id=t.id;
var interval=setInterval(function(){
increment=increment+1;
if(increment>=3){
clearInterval(interval);
t.addEventListener("mousemove",function(event){
t.style.position="absolute";
t.style.top=event.screenY+"px";
t.style.left=event.screenX+"px";
});
}
},500);
t.addEventListener("mouseup",function(){
increment=0;
clearInterval(interval);
});
}

Hide cursor or have custom cursor in Windows 8 Metro

I want to know if there is a way to hide cursor in Windows 8 Metro mode. I found
this answer, but then I don't know how to obtain the
"unique resource id" for the second parameter of the cursor constructor (below).
Window.Current.CoreWindow.PointerCursor =
new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, 1);
EDIT: Forgot to mention that I need to handle mouse events normally so the answer below of setting cursor to null will not suffice.
Set the cursor to a custom cursor but make it just be blank...this allows you to track it like being a normal cursor.
You can set the PointerCursor object to NULL. As soon as you move over something like a text box, it will reset it back though. So you probably need to handle mouse over events on various controls, to hide it. This all depends on your complete scenario tough.
Also, before setting it to NULL, you can save the value of the property (PointerCursor) and then when you're done, set it back.