Search Results

Search found 799 results on 32 pages for 'textfield'.

Page 2/32 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Windows API Textfield with offset characters

    - by genesys
    Hi there! Is it possible using the Windows API, to create a textfield that lets me offset characters by exact pixels? if so - how? for example, I would like to place two O letters on top of each other, such that they form something like an 8 ? context is an application for a language where most of the glyphs are written left to right, but sometimes some of the glyphs are stacket on top of each other. Windows API because the framework we're using already uses the Windows API for the whole GUI. Thanks!

    Read the article

  • Check if NSMutableArray contains text from textfield

    - by Polo Swelsen
    I want to check if the text inserted in a textfield is also in my NSMutableArray. So let's say my NSMutableArray has these objects: "Hey, Hello, No, Yes". Then when a user enters the text: "Hello" i want there to appear a UIAlertView. I now have the following: for (int slt = 0; slt < [zouten count]; slt++) { if (zout.text = [zouten objectAtIndex:slt]) { alert = [[UIAlertView alloc]initWithTitle:@"Goedzo!" message:[NSString stringWithFormat:@"Je hebt een zout gevonden"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; } } [alert show]; But somehow the message appears with every word. what am i doing wrong?

    Read the article

  • Detecting what changed in an HTML Textfield

    - by teehoo
    For a major school project I am implementing a real-time collaborative editor. For a little background, basically what this means is that two(or more) users can type into a document at the same time, and their changes are automatically propagated to one another (similar to Etherpad). Now my problem is as follows: I want to be able to detect what changes a user carried out onto an HTML textfield. They could: Insert a character Delete a character Paste a string of characters Cut a string of characters I want to be able to detect which of these changes happened and then notify other clients similar to "insert character 'c' at position 2" etc. Anyway I was hoping to get some advice on how I would go about implementing the detection of these changes? My first attempt was to consider the carot position before and after a change occurred, but this failed miserably. For my second attempt I was thinking about doing a diff on the entire contents of the textfields old and new value. Am I missing anything obvious with this solution? Is there something simpler?

    Read the article

  • Format textfield while typing Ios

    - by BBios
    Ive seen other examples and tried - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string I am not sure what I am doing wrong, I just started coding my first Iphone App This is what I am trying to do I have 4 textfields and each has a limit on number of letters while typing I have done this using the below code - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { int valid; NSString *cs2 = [textField.text stringByReplacingCharactersInRange:range withString:string]; // int charCount = [cs2 length]; if(textField == cvv){ valid = 4; }else if(textField == cardName) { valid=26; }else if(textField == expDate) { valid=5; // if (charCount == 2 ) { // textField.text = [cs2 stringByAppendingString:@"/"]; // textField.text = cs2; // return YES; // } }else if(textField == acNumber) { valid=19; } return !([cs2 length] > valid); Works fine till here, I have a textfield where the user enters Exp date and would like to format it as if I am entering 112 then it should display as 01/12 and if I enter 2 then it should display as 1122 I tried checking if the length of the textfield value is 2 then append a / but then that gives me when I enter 12 it gives 11/22

    Read the article

  • Is there a way to catch a MOUSE_UP Event over a static textfield in Flash?

    - by Jovica Aleksic
    When the user presses the mouse, and releases it over a static textfield with selectable text, no MOUSE_UP event is fired - not on the stage and also nowhere else. I experienced this when using a scrollbar class on a movieclip with a nested static textfield. When the user drags the scroll handle and releases the mouse over the textfield, the dragging/scrolling is stuck. To test this, create a new AS3 fla file, place a static textfield somewhere, and put in some text. Make sure the selectable property is checked in the properties panel. Add this script to the timeline: import flash.events.* function down(event:Event):void { trace('down'); } function up(event:Event):void { trace('up'); } stage.addEventListener(MouseEvent.MOUSE_DOWN, down) stage.addEventListener(MouseEvent.MOUSE_UP, up) Now test the movie and click the mouse. You will notice that trace('up') will not occur when you release the mouse over the textfield.

    Read the article

  • Flash AS3 - Scroll dynamic textfield to a specific part just like HTML anchor

    - by Aamir Mahmood
    Hi, We are building a flash website with cms at the back end, and we are allowing admin to put anchors inside a content. Later we created a smaller version of the whole content to display just a small part and then [read more] button. Which add a new layer on top of every thing acting like a popup and it is populated with complete content. Now we would like to scroll that text inside popup to that portion which [read more] button was clicked. The most common example inside HTMl is go to top link in footer on most of the sites which move the whole document to top. Happy codding.

    Read the article

  • Ajax: strange behaviour while checking a textfield

    - by ilnur777
    I have a registration form with checking the available name for username field through ajax. Inputing a username into username field and pushing the "Check!" button, the script sends value to php script. Then php script replaces the username field with the username field + style like this: <input type="text" name="login" value="'.$_GET["user"].'" style="width:205; height:22; border-width:1; border-color:red; border-style:solid; background-color:rgb(255,232,230);"> So when replacing the username field in the form with its equivalent from php script and then submitting a form, it is then get to script on the page that checks whether the username field is empty or not. And it returns an error that it is empty, though after checking through ajax the username field it has value. I don't understand why it gets to empty field checking script, having the same field name and having value?

    Read the article

  • Validation for textfield is not working

    - by MaheshBabu
    Hi folks, I am using 4 Textfields in my application. I need to validate those textfields like,These 4 textfields Allow only o,1,....9 and . For that i use the code like this. - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { static NSCharacterSet *charSet = nil; if(!charSet) { charSet = [[[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet] retain]; } NSRange location = [string rangeOfCharacterFromSet:charSet]; return (location.location == NSNotFound); And first textfield allows digits 10,second third and fourth textfields allows less than 100. For that my code is if (textField.tag == 1) { NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; double homevaluedouble = [newString doubleValue]; return !(homevaluedouble > 10000000000); } if (textField.tag == 2) { NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; double validate = [newString doubleValue]; return !(validate > 100); } if (textField.tag == 3) { NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; double validate = [newString doubleValue]; return !(validate > 100); } I write this code in - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { But textfields allows 0,1,..9 and . but digit limit is not working, if i remove 0,1,...9 then limit to textfield working. i am getting confuse with it. can any one pls help me,How can i resolve it. Thank u in advance.

    Read the article

  • TextField breaking MOUSE_OVER in as3: only after moving it!

    - by Franz
    I'm having a really weird problem with the MOUSE_OVER event. I'm building dynamic tabs representing mp3 songs containing textfields with info and a dynamic image for the cover art. I am trying to get a simple MOUSE_OVER working over the whole tab, such that you can select the next song to play. I am using a Sprite with alpha 0 that overlays my whole tab (incl. the textFields) as a Listener for MOUSE_OVER and _OUT... I've checked by setting the alpha to something visible and it indeed covers my tab and follows it around as I move it (just making sure I'm not moving the tab without moving the hotspot). Also, I only create it once my cover art is loaded, ensuring that it will cover that too. Now, when the tab is in the top position, everything is dandy. As soon as I move the tab to make space for the next tab, the textFields break my roll behaviour... just like that noob mistake of overlaying a sprite over the one that you're listening for MouseEvents on. But... the roll area is still on top of the field, I've set selectable and mouseEnabled to false on the textFields... nothing. It is as if the mere fact of moving the whole tab now puts the textField on top of everything in my tab (whereas visually, it's still in its expected layer). I'm using pixel fonts but tried it with system fonts, same thing... at my wits end here. public function Tab(tune:Tune) { _tune = tune; mainSprite = new Sprite(); addChild(mainSprite); drawBorder(); createFormat(); placeArtist(); placeTitle(); placeAlbum(); coverArt(); } private function placeButton():void { _button = new Sprite(); _button.graphics.beginFill(0xFF000,0); _button.graphics.drawRect(0,0,229,40); _button.graphics.endFill(); _button.addEventListener(MouseEvent.MOUSE_OVER, mouseListener); _button.addEventListener(MouseEvent.MOUSE_OUT, mouseListener); _button.buttonMode = true; mainSprite.addChild(_button); } private function mouseListener(event:MouseEvent):void { switch(event.type){ case MouseEvent.MOUSE_OVER : hilite(true); break; case MouseEvent.MOUSE_OUT : hilite(false); break; } } private function createFormat():void { _format = new TextFormat(); _format.font = "FFF Neostandard"; _format.size = 8; _format.color = 0xFFFFFF; } private function placeArtist():void { var artist : TextField = new TextField(); artist.selectable = false; artist.defaultTextFormat = _format; artist.x = 41; artist.y = 3; artist.width = 135; artist.text = _tune.artist; artist.mouseEnabled = false; mainSprite.addChild(artist); } private function placeTitle():void { var title : TextField = new TextField(); title.selectable = false; title.defaultTextFormat = _format; title.x = 41; title.y = 14; title.width = 135; title.text = _tune.title; title.mouseEnabled = false; mainSprite.addChild(title); } private function placeAlbum():void { var album : TextField = new TextField(); album.selectable = false; album.defaultTextFormat = _format; album.x = 41; album.y = 25; album.width = 135; album.text = _tune.album; album.mouseEnabled = false; mainSprite.addChild(album); } private function drawBorder():void { _border = new Sprite(); _border.graphics.lineStyle(1, 0x545454); _border.graphics.drawRect (0,0,229,40); mainSprite.addChild(_border); } private function coverArt():void { _image = new Sprite(); var imageLoader : Loader = new Loader(); _loaderInfo = imageLoader.contentLoaderInfo; _loaderInfo.addEventListener(Event.COMPLETE, coverLoaded) var image:URLRequest = new URLRequest(_tune.coverArt); imageLoader.load(image); _image.x = 1.5; _image.y = 2; _image.addChild(imageLoader); } private function coverLoaded(event:Event):void { _loaderInfo.removeEventListener(Event.COMPLETE, coverLoaded); var scaling : Number = IMAGE_SIZE / _image.width; _image.scaleX = scaling; _image.scaleY = scaling; mainSprite.addChild (_image); placeButton(); } public function hilite(state:Boolean):void{ var col : ColorTransform = new ColorTransform(); if(state){ col.color = 0xFFFFFF; } else { col.color = 0x545454; } _border.transform.colorTransform = col; }

    Read the article

  • How to let the user choose between typing price inclusive VAT or exclusive VAT in TextField?

    - by Sanoj
    I am implementing an back-office application where the user type in prices for products. Sometimes it is preferred to type the price inclusive value-added-tax, VAT and sometimes exclusive VAT. How do I best let the user choose between the inclusive or exclusive VAT in a usability perspective? I could have two TextFields above eachother one inclusive VAT and one exclusive, and reflect the input. But I don't think that reflecting the input in another TextField at realtime is good when it comes to usability, it distracts the user. I could also have two Radiobuttons above the TextField or below, or maybe besides the TextField that let the user make the choice. Or should I have a single button for turning between inclusive/exclusive VAT? like On/Off-buttons. But what text should I have on the button and how should the button be designed? I think this is good because it takes less space and it is easy to have it close to the TextField, but it's very hard to design a good button in a usability perspective. Please give me some recommendations. Maybe someone of you works with usability or have seen a similar problem.

    Read the article

  • How do you have grayed out text in a textfield that dissapears when the user clicks on it

    - by John Smith
    In HTML & JS, how do you make a textfield that has grayed out text telling the user what the field is for that goes away when the user clicks on the field? For example, in firefox the search field in the top right hand side says which search engine it uses when there's nothing entered, then once you click it's an empty textfield, but if you leave it blank and remove focus from the textfield then the grayed out text is back again. Is there a name for this behavior? Also, is it possible to do in pure css without the use of js to do the on focus / on blur events?

    Read the article

  • AS3 TextField is blank, doesn't accept any of my settings??

    - by Andy Melichar
    Having a strange issue with assigning a TextField to a movie clip. nameFormat = new TextFormat(); nameFormat.size = 14; nameFormat.color = "0x000000"; nameFormat.border = true; nameFormat.font = "Arial"; charName = new TextField(); charName.defaultTextFormat = nameFormat; charName.text = value.charname; charName.x = 92.5; charName.y = 6.5; charName.width = 205; charName.height = 21; thechars[value.charid].addChild(charName); If I trace charName.text it traces correctly, but when the containing movieclip is displayed, it is always blank and none of my settings (borders, background color, etc..) show up. I'm placing several of these movieclips into another movieclip, which is then added to a scroller as such: scrollContent.addChild(thechars[newvalue.charid]); theScroller.source = scrollContent; The strange thing is that I am using the exact same method to drop a button into each of the 'thechars' and it shows up and works fine. AND... if I hover my mouse over the spot where the textField should be, I can see my mouse change from a pointer to a text cursor, so the textFields are showing up, they are just blank? Help?

    Read the article

  • AWT Textfield behaves weird with MicroSoft JVM

    - by AKh
    Hi, I am facing a weird problem when using MicroSoft JVM to run my Applet. I have an AWT panel with 4 textfields which is added to a dialog box. Everything goes fine until I enter a decimal value into the textfield and close the dialog box. When i reopen the dialog box the textfield inside the panel with all the decimal digits (entered in the previous step) behaves weird. The decimal values along with the WHITE area inside the textfield moves to the left and hides the digits. When I click inside the textfield it becomes normal. The Panel earlier had gridlayout and I even tried changing it to gridbaylayout and still the problem persist. NOTE: All Development are pertained to JRE1.1 to compatibility with MS JVM If any can help me with this it would be a great help. Thanks in advance. . . . . public MyPanel(Dialog myDialog) { Panel panel = new Panel(); this.dialog = myDialog; //Previous code with grid layout /* panel.setLayout(new GridLayout2(4,2,2,2)); panel.add(new Label("Symbol:")); panel.add(symbolField = new TextField("",20)); panel.add(new Label("Quantity:")); panel.add( qtyField = new TextField()); panel.add(new Label("Price per Share:")); panel.add( costField = new TextField()); panel.add(new Label("Date Acquired:")); panel.add( purchaseDate = new TextField() );*/ GridBagLayout gridbag = new GridBagLayout(); System.out.println("######## Created New GridBagLayout"); GridBagConstraints constraints = new GridBagConstraints(); panel.setLayout( gridbag ); constraints = buildConstraints( constraints, 0, 0, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( new Label("Symbol:"), constraints); constraints = buildConstraints( constraints, 1, 0, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( symbolField = new TextField("",20), constraints); constraints = buildConstraints( constraints, 0, 1, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( new Label("Quantity:"), constraints); constraints = buildConstraints( constraints, 1, 1, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( qtyField = new TextField(), constraints); constraints = buildConstraints( constraints, 0, 2, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( new Label("Price per Share:"), constraints); constraints = buildConstraints( constraints, 1, 2, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( costField = new TextField(), constraints); constraints = buildConstraints( constraints, 0, 3, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( new Label("Date Acquired:"), constraints); constraints = buildConstraints( constraints, 1, 3, 1, 1, 1.5, 1 ); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; panel.add( purchaseDate = new TextField(), constraints); .............. ......... }

    Read the article

  • Flash AS3: crop TextField content off at X lines, add '...' at the end

    - by matt lohkamp
    There's only room for three lines of text in the interface, but the content is external and variable, and if it ends up taking up more than three lines, there needs to be some sort of 'view all' button functionality. I can kind of think about what that function needs to look like, but I'm not quite sure what the best way to do it in AS3 would be. Something like (in pseudo code): function cropText(source:TextField, length:int, append:String):TextField{ if(source.lineCount > length){ source.text = // magic function that retuns the first length lines, // minus append.length characters, with the append value tacked onto the end } return source; } ... right? How would you fill in the missing bit?

    Read the article

  • Replace Listmenu with Textfield

    - by BRADINO
    Say you have a dropdown form field where you ask the user how they heard about you. You have numerous options and also an other field where if they selected other, then they enter the value in a text field. This is a cleaner alternative where if the user selects Other, then the dropdown turns into a textfield of the same name, so that your post routine, grooming, validation, writing to DB etc all works seamlessly. This example uses prototype JS library. Here is a working example: How did you hear about BRADINO? Select Google Yahoo MSN Other All you have to do is have an dropdown option for Other and then add call the function onchange: onchange="overrideListmenu('how-heard');" Here is the javascript function that uses Prototype: function overrideListmenu(field){         if ($F(field) == 'Other'){             Element.replace($(field), '<input name="'+field+'" id="'+field+'" type="text" value="">');                 $(field).focus();         } } Here is the javascript function that uses jQuery: function overrideListmenu(field){         if ($('#'+field).val() == 'Other'){             $('#'+field).after('<input name="'+field+'" id="'+field+'" type="text" value="">').remove();                 $('#'+field).focus();         } } listmenu replace textfield textfield for other how did you hear about us

    Read the article

  • Flex/Flash: Don't show 'bar' cursor when dragging over a TextField/TextArea?

    - by David Wolever
    As the title suggests, how can I prevent the "bar" cursor from appearing when I click-and-drag over a TextField? For example, consider this interaction: I'd like to prevent the cursor changing to the "bar" in step "2". How can I do that? I've tried fiddling with the selectable flag: protected static function fixMouseOverAfordance(field:TextField):void { var iOwnClick:Boolean = false; function handleMouseOver(event:MouseEvent):void { if (event.buttonDown) { field.selectable = iOwnClick; } else { field.selectable = true; iOwnClick = false; } } field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent):void { iOwnClick = true; field.selectable = true; }); } But the "bar" cursor still appears the first time the mouse is moved over the text field (however, after it has been moved out then moved back in, it does the right thing).

    Read the article

  • Flash AS3: How to Make scroll bar react to dynamic textfield movement?

    - by HeroicNate
    I've been looking for a tutorial and answer to this for a while but can't find what I'm looking for. I am loading html text into a dynamic textfield, and I have a scrollbar controlling the scroll using the code below. What I want to do is also add scroll up/down buttons and have the scroll bar move in relation to the text scroll. I was just going to use "tracklistingtext.scrollV -- " for the scroll buttons, but right now the scroll bar doesn't recognize the text movement. What do I need to do to get the scroll bar to listen to the text scroll position? var listTextreq:URLRequest=new URLRequest("tracklist.txt"); var listTextLoader:URLLoader = new URLLoader(); var bounds:Rectangle=new Rectangle(scrollMC.x,scrollMC.y,0,300); var scrolling:Boolean=false; function fileLoaded(event:Event):void { tracklistingtext.htmlText=listTextLoader.data; tracklistingtext.multiline=true; tracklistingtext.wordWrap=true; scrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startScroll); stage.addEventListener(MouseEvent.MOUSE_UP, stopScroll); addEventListener (Event.ENTER_FRAME, enterHandler); } listTextLoader.addEventListener(Event.COMPLETE, fileLoaded); listTextLoader.load(listTextreq); function startScroll(e:Event):void { scrolling=true; scrollMC.startDrag(false,bounds); } function stopScroll(e:Event):void { scrolling=false; scrollMC.stopDrag(); } function enterHandler (e:Event):void { if (scrolling == true) { tracklistingtext.scrollV = Math.round(((scrollMC.y - bounds.y)/300)*tracklistingtext.maxScrollV); } } Any help is greatly appreciated.

    Read the article

  • How can I stop Flash from changing indent when user Clicks on hyperlink in TextField?

    - by Paul Chernoch
    I have a TextField which I initialize by setting htmlText. The text has anchor tags (hyperlinks). When a user clicks on the hyperlink, the indentation of the second and subsequent lines in the paragraph changes. Why? How do I stop it? My html has an image at the beginning of the line, followed by the tag, followed by more text. To style the hyper links to look blue always and underlined when the mouse is over them, I do this: var css:StyleSheet = new StyleSheet(); css.parseCSS("a {color: #0000FF;} a:hover {text-decoration: underline;}"); stepText.styleSheet = css; stepText.htmlText = textToUse; stepText.visible = true; Here is a fragment of the html text (with newlines and exrta whitespace added to improve readability - originally it was one long line): <textformat indent="-37" blockindent="37" > <img src="media/interface/level-1-bullets/solid-circle.png" align="left" hspace="8" vspace="1"/> American Dental Association. (n.d.). <i>Cleaning your teeth and gums (oral hygiene)</i>. Retrieved 11/24/08, from <a href="http://www.ada.org/public/topics/cleaning_faq.asp" target="_blank">http://www.ada.org/public/topics/cleaning_faq.asp </a> </textformat> <br/> As it turns out, the text field is of a width such that it wraps and the second line starts with "Retrieved 11/24/08". Clicking on the hyper link causes this particular line to be indented. Subsequent paragraphs are not affected. ASIDE: The image is a list bullet about 37 pixels wide. (I used images instead of li tags because Flash does not allow nested lists, so I faked it using a series of images with varying amounts of whitespace to simulate three levels of indentation.) IDEA: I was thinking of changing all hyperlinks to use "event:" as the URL protocol, which causes a TextEvent.LINK event to be triggered instead of following the link. Then I would have to open the browser in a second call. I could use this event handler to set the html text to itself, which might clear the problem. (When I switch pages in my application and then come back to the page, everything is OKAY again.) PROBLEM: If I use the "event:" protocol and user tries the right-mouse button click, they will get an error, or so I am told. (See http://www.blog.lessrain.com/as3-texteventlink-and-contextmenu-incompatibilities/ ) I do not like this trade-off.

    Read the article

  • Need code for make barcode data separate into two textfield

    - by klox
    hello...i have a problem with my project..i want to use barcode scanner for input data to textfield (i'm using jquery). this barcode scanner read serial number and model name of each product..but after scan, serial number and model name appear in one textfield. how to make them appear separately into different text field..first textfield for serial number and second textfield for model name... is there some code to make it??use ajax,javascript or something else??

    Read the article

  • Useful WatiN Extension Methods

    - by Steve Wilkes
    I've been doing a fair amount of UI testing using WatiN recently – here’s some extension methods I've found useful. This checks if a WatiN TextField is actually a hidden field. WatiN makes no distinction between text and hidden inputs, so this can come in handy if you render an input sometimes as hidden and sometimes as a visible text field. Note that this doesn't check if an input is visible (I've got another extension method for that in a moment), it checks if it’s hidden. public static bool IsHiddenField(this TextField textField) { if (textField == null || !textField.Exists) { return false; } var textFieldType = textField.GetAttributeValue("type"); return (textFieldType != null) && textFieldType.ToLowerInvariant() == "hidden"; } The next method quickly sets the value of a text field to a given string. By default WatiN types the text you give it into a text field one character at a time which can be necessary if you have behaviour you want to test which is triggered by individual key presses, but which most of time is just painfully slow; this method dumps the text in in one go. Note that if it's not a hidden field then it gives it focus first; this helps trigger validation once the value has been set and focus moves elsewhere. public static void SetText(this TextField textField, string value) { if ((textField == null) || !textField.Exists) { return; } if (!textField.IsHiddenField()) { textField.Focus(); } textField.Value = value; } Finally, here's a method which checks if an Element is currently visible. It does so by walking up the DOM and checking for a Style.Display of 'none' on any element between the one on which the method is invoked, and any of its ancestors. public static bool IsElementVisible(this Element element) { if ((element == null) || !element.Exists) { return false; } while ((element != null) && element.Exists) { if (element.Style.Display.ToLowerInvariant().Contains("none")) { return false; } element = element.Parent; } return true; } Hope they come in handy

    Read the article

  • (iOS) UI Automation AlertPrompt button/textField accessiblity

    - by lipd
    I'm having a bit of trouble with UI Automation (the built in to iOS tool) when it comes to alertView. First off, I'm not sure where I can set the accessibilityLabel and such for the buttons that are on the alertView. Secondly, although I am not getting an error, I can't get my textField to actually set the value of the textField to something. I'll put up my code for the alertView and the javaScript I am using for UI Automation. UIATarget.onAlert = function onAlert(alert) { // Log alerts and bail, unless it's the one we want var title = alert.name(); UIALogger.logMessage("Alert with title '" + title + "' encountered!"); alert.logElementTree(); if (title == "AlertPrompt") { UIALogger.logMessage(alert.textFields().length + ''); target.delay(1); alert.textFields()["AlertText"].setValue("AutoTest"); target.delay(1); return true; // Override default handler } else return false; } var target = UIATarget.localTarget(); var application = target.frontMostApp(); var mainWindow = application.mainWindow(); mainWindow.logElementTree(); //target.delay(1); //mainWindow.logElementTree(); //target.delay(1); var tableView = mainWindow.tableViews()[0]; var button = tableView.buttons(); //UIALogger.logMessage("Num buttons: " + button.length); //UIALogger.logMessage("num Table views: " + mainWindow.tableViews().length); //UIALogger.logMessage("Number of cells: " + tableView.cells().length); /*for (var currentCellIndex = 0; currentCellIndex < tableView.cells().length; currentCellIndex++) { var currentCell = tableView.cells()[currentCellIndex]; UIALogger.logStart("Testing table option: " + currentCell.name()); tableView.scrollToElementWithName(currentCell.name()); target.delay(1); currentCell.tap();// Go down a level target.delay(1); UIATarget.localTarget().captureScreenWithName(currentCell.name()); //mainWindow.navigationBar().leftButton().tap(); // Go back target.delay(1); UIALogger.logPass("Testing table option " + currentCell.name()); }*/ UIALogger.logStart("Testing add item"); target.delay(1); mainWindow.navigationBar().buttons()["addButton"].tap(); target.delay(1); if(tableView.cells().length == 5) UIALogger.logPass("Successfully added item to table"); else UIALogger.logFail("FAIL: didn't add item to table"); Here's what I'm using for the alertView #import "AlertPrompt.h" @implementation AlertPrompt @synthesize textField; @synthesize enteredText; - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle okButtonTitle:(NSString *)okayButtonTitle withOrientation:(UIInterfaceOrientation) orientation { if ((self == [super initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:okayButtonTitle, nil])) { self.isAccessibilityElement = YES; self.accessibilityLabel = @"AlertPrompt"; UITextField *theTextField; if(orientation == UIInterfaceOrientationPortrait) theTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; else theTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 30.0, 260.0, 25.0)]; [theTextField setBackgroundColor:[UIColor whiteColor]]; [self addSubview:theTextField]; self.textField = theTextField; self.textField.isAccessibilityElement = YES; self.textField.accessibilityLabel = @"AlertText"; [theTextField release]; CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 0.0); [self setTransform:translate]; } return self; } - (void)show { [textField becomeFirstResponder]; [super show]; } - (NSString *)enteredText { return [self.textField text]; } - (void)dealloc { //[textField release]; [super dealloc]; } @end Thanks for any help!

    Read the article

  • jsp TextField binding

    - by user72185
    I have a panel in my Page1.jsp: <webuijsf:panelLayout binding="#{Page1.dynamicFieldsPanel}" id="dynamicFieldsPanel" -rave-layout: grid"/> Then I have this in Page1.java: private PanelLayout dynamicFieldsPanel = new PanelLayout(); public void setDynamicFieldsPanel(PanelLayout pl) { this.dynamicFieldsPanel = pl; } public PanelLayout getDynamicFieldsPanel() { TextField textField = new TextField(); this.dynamicFieldsPanel.getChildren().add(textField); return dynamicFieldsPanel; } How do I bind my dynamic TextField to something so I can retrieve the value entered by the user?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >