Пример #1
0
 public TextBox(string name)
     : base(name)
 {
     _element = (InputElement)Document.CreateElement("input");
     OnResize += TextBox_OnResize;
     Width = "250px";
 }
Пример #2
0
 public override void Dispose()
 {
     if (_target != null) {
         _target.RemoveEventListener("change", _changeListener, false);
         _target = null;
     }
 }
Пример #3
0
		public static void InputKeypressHandler(jQueryEvent evt, InputElement el, TransformCharDelegate transformChar) {
			if (evt.AltKey || evt.CtrlKey)
				return; // don't ever change Alt+key or Ctrl+key

			if (jQuery.Browser.MSIE) {
				if (evt.Which == 13)
					return; // Enter seems to be the only non-printable key we catch in IE.
				char newc = transformChar((char)evt.Which);
				if (newc == 0) {
					evt.PreventDefault();
				}
				else if (newc != evt.Which) {
					((dynamic)evt).originalEvent.keyCode = newc;
				}
			}
			else {
				if (evt.Which == 0)
					return; // Firefox, and likely other non-IE browsers, lets us trap non-characters, but we don't want that.

				char newc = transformChar((char)evt.Which);
				if (newc == 0) {
					evt.PreventDefault();
				}
				else if (newc != evt.Which) {
					int startPos = ((dynamic)el).selectionStart,
					    endPos   = ((dynamic)el).selectionEnd;
					string oldVal = el.Value;
					el.Value = oldVal.Substr(0, startPos) + String.FromCharCode(newc) + oldVal.Substr(endPos);
					((dynamic)el).setSelectionRange(startPos + 1, startPos + 1);
					evt.PreventDefault();
				}
			}
		}
Пример #4
0
 public ValueBinder(InputElement target, Expression expression)
     : base(target, "value", expression)
 {
     _target = target;
     _changeListener = OnChanged;
     target.AddEventListener("change", _changeListener, false);
 }
		public MultiSelectorBehaviour(Element container, HtmlAutoCompleteBehaviour htmlAutoComplete, InputElement hiddenOutput)
		{
			this.container = container;
			this.hiddenOutput = hiddenOutput;
			this.HtmlAutoComplete = htmlAutoComplete;
			this.HtmlAutoComplete.ItemChosen = htmlAutoComplete_ItemChosen;
			selections = new PairListField(hiddenOutput);
			InitialiseInitialSelections();
			jQuery.FromElement(this.container).Click(this.OnClick);
			
		}
Пример #6
0
		public WatermarkExtender(InputElement el, string watermark)
		{
			this.el = el;
			this.watermark = watermark;
			jQuery.FromElement(el).Focus(OnFocus);
			jQuery.FromElement(el).Blur(OnBlur);
			((Dictionary<object, object>)(object)el)["readOnly"] = null;
			
			
			
		}
Пример #7
0
		public static bool WhenLoggedInButtonValidator(InputElement element, string validators)
		{
			PageImplementation.WhenLoggedIn(
				new Action(
					delegate()
					{
						Script.Eval("WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\"" + element.ID.Replace("_", "$") + "\", \"\", true, \"" + validators + "\", \"\", false, true));");
					}
				)
			);
			return false;
		}
Пример #8
0
		public PairListField(InputElement hiddenField)
		{
			this.hiddenField = hiddenField;
		}
		public HtmlAutoCompleteBehaviour(InputElement input, InputElement hiddenInput, Element anchor, bool isSuggest, InputElement parametersHiddenField)
		{
			//ElementAttribute cometAtt = input.GetAttributeNode(HtmlAutoCompleteAttributes.CometServiceUrl);

			remoteSuggestionsGetter = new Js.ClientControls.HtmlAutoComplete.WebServiceRemoteSuggestionsGetter(
				input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceUrl).Value,
				input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceMethod).Value
			);
			
			this.mode = isSuggest == true ? HtmlAutoCompleteMode.Suggest : HtmlAutoCompleteMode.Complete;
			this.input = input;
			this.hiddenInput = hiddenInput;
			this.anchor = anchor == null ? input : anchor;
			jQuery.FromElement(input).Blur(delegate(jQueryEvent e) { Window.SetTimeout(DoBlur, 250); });
			jQuery.FromElement(input).Keydown(this.HandleKeyDown);
			jQuery.FromElement(input).Keyup(this.HandleKeyUp);
			jQuery.FromElement(input).Focus(CallOnFocus);

			ElementAttribute waterMarkNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark);
			if (waterMarkNode != null)
			{
				watermarker = new WatermarkExtender(input, input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark).Value);
			}
			ElementAttribute popupLeftNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset);
			popupLeftOffset = popupLeftNode == null ? 0 : int.Parse(popupLeftNode.Value);
			ElementAttribute popupTopNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupTopOffset);
			popupTopOffset = popupTopNode == null ? 0 : int.Parse(popupTopNode.Value);
			ElementAttribute rightAlignNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.RightAlign);
			rightAlign = rightAlignNode == null ? false : bool.Parse(rightAlignNode.Value);
			
			if (input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset) != null)
			{
				popupLeftOffset = int.Parse(input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset).Value);
			}
			Parameters = new PairListField(parametersHiddenField);
			Suggestions.OnSuggestionsChanged = delegate() { DisplaySuggestionsInPopupMenu(); };

			this.remoteSuggestionsGetter.OnAllSuggestionsReceived = delegate() 
			{ 
				RemoveLowPrioritySuggestionsAndSetRemainingSuggestionsToLowPriority();
				HideAjaxIcon();
			};
			this.remoteSuggestionsGetter.OnSuggestionsRequested = delegate()
			                                                      {
			                                                      	ShowAjaxIcon();
			                                                      };
			
			this.remoteSuggestionsGetter.OnSuggestionReceived = delegate(Suggestion[] newSuggestions) 
			{
				Trace.Write("Received" + newSuggestions.Length + "suggestions");
				if (TransformReceivedSuggestions != null)
				{
					AddSuggestions(TransformReceivedSuggestions(newSuggestions, maxNumberOfItemsToGet));
				}
				else
				{
					AddSuggestions(newSuggestions);
				}
			};
			this.remoteSuggestionsGetter.OnAbortCurrentRequest= delegate()
			                                                      {
			                                                      	HideAjaxIcon();

			                                                      };
			

		}
Пример #10
0
		public static bool WhenLoggedInButtonNoValidation(InputElement element)
		{
			PageImplementation.WhenLoggedIn(
				new Action(
					delegate()
					{
						Script.Eval("__doPostBack(\"" + element.ID.Replace("_", "$") + "\",'');");
					}
				)
			);
			return false;
		}
Пример #11
0
		public static bool WhenLoggedInButton(InputElement element)
		{
			return WhenLoggedInButtonValidator(element, "");
		}
Пример #12
0
		void defaultButton(InputElement textBox, InputElement button)
		{
			jQuery.FromElement(textBox).Keyup(delegate(jQueryEvent e)
			{
				if (e.Which == 13)
				{
					if (AsyncInProgress)
						return;

					button.Click();

				}
			});
		}
Пример #13
0
		public static bool WhenLoggedInRadio(InputElement element)
		{
			PageImplementation.WhenLoggedIn(
				new Action(
					delegate()
					{
						Script.Eval("setTimeout('__doPostBack(\\'" + element.ID.Replace("_", "$") + "\\',\\'\\')', 0);");
					}
				)
			);
			return true;
		}