How to focus two text boxes at a time?

Hi,
I am developing a packet analyzer software. In that, I need to focus two text boxes as I select a treeview item.
I am using a following code:
delegate void voiDelegate();
private void click(object sender, RoutedPropertyChangedEventArgs<object> e)
TreeViewItem t;
t =(TreeViewItem) tvMain.SelectedItem;
StackPanel s = (StackPanel)t.Header;
List<TextBlock> l = new List<TextBlock>(3);
foreach (TextBlock children in s.Children)
l.Add(children);
string ch = l[3].Text;
string[] sp = ch.Split('-');
int te = Convert.ToByte(sp[1]) - Convert.ToByte(sp[0]) + 1;
PacketDisplay1.SelectionStart = PacketDisplay2.SelectionStart = Convert.ToByte(sp[0]);
PacketDisplay1.SelectionLength= PacketDisplay2.SelectionLength = te;
voiDelegate giveFocusDelegate = new voiDelegate(giveFocus);
Dispatcher.BeginInvoke(giveFocusDelegate, new object[] { });
private void giveFocus()
PacketDisplay1.Focus();
PacketDisplay2.Focus();
but here I am able to focus only on second Textbox. I need to focus on both textboxes. How can I achieve this?
My requirement is like this
thank you.

The documentation is pretty clear on this: There can be only one
element on the whole desktop that has keyboard focus:
https://msdn.microsoft.com/en-us/library/aa969768%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396.
There is logical focus and there is keyboard focus. There can be multiple elements that have logical focus in an application but only a single element can have keyboard focus. Please refer to the link above for details.
If you want to highlight text in two different TextBoxes at the same time, you could replace the TextBox elements with RichTextBox elements, and set the background of a text range. Please refer to the following thread for more information about how you could
do this:
http://stackoverflow.com/questions/18015380/how-can-i-change-the-selected-text-background-color-in-rich-text-box-wpf-c-sharp
Here is an example for you:
public partial class Window6 : Window
private static TextPointer GetTextPointAt(TextPointer from, int pos)
TextPointer ret = from;
int i = 0;
while ((i < pos) && (ret != null))
if ((ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text) || (ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.None))
i++;
if (ret.GetPositionAtOffset(1, LogicalDirection.Forward) == null)
return ret;
ret = ret.GetPositionAtOffset(1, LogicalDirection.Forward);
return ret;
internal string Select(RichTextBox rtb, int offset, int length, Color color)
// Get text selection:
TextSelection textRange = rtb.Selection;
// Get text starting point:
TextPointer start = rtb.Document.ContentStart;
// Get begin and end requested:
TextPointer startPos = GetTextPointAt(start, offset);
TextPointer endPos = GetTextPointAt(start, offset + length);
// New selection of text:
textRange.Select(startPos, endPos);
// Apply property to the selection:
textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(color));
// Return selection text:
return rtb.Selection.Text;
public Window6()
InitializeComponent();
//set text
PacketDisplay1.Document.Blocks.Clear();
PacketDisplay1.Document.Blocks.Add(new Paragraph(new Run("some text....")));
PacketDisplay2.Document.Blocks.Clear();
PacketDisplay2.Document.Blocks.Add(new Paragraph(new Run("some other text....")));
//set background
this.Select(this.PacketDisplay1, 0, 4, SystemColors.HighlightBrush.Color); //select "some"
this.Select(this.PacketDisplay2, 0, 4, SystemColors.HighlightBrush.Color); //select "some"
There is no way to achieve this by simply selecting text in two different TextBoxes and there is no way to set the background of a text range in a ordinary TextBox so you must use a RichTextBox here.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

Similar Messages

  • How to select two text boxes (linked) separated by a distance?

    dear all,
    how to select two boxes in an indd CS6 document? I tried to label them also but unable to select.
    Virender

    Dear Uwe, Many thanks for your points.
    I have 10 indd files and each file has one page and a table is only item present on page. So few files has table present in one table and few files has two text boxes because table has many rows so spiltted in two linked text boxes.
    I somehow able to select both text boxes but while exporting them only one text box table get exported as png because of improper code.
    #target Indesign
    var sourceFolder = new Folder ("/Users/admin4/Desktop/INS");
    var myFiles = sourceFolder.getFiles();
    //alert (myFiles.length);
    var destFolder = new Folder ("/Users/admin4/Desktop/folder3");
    for (i=0; i < myFiles.length; i++)
         if (myFiles[i].name !=".DS_Store")
         var sourceDoc = app.open(myFiles[i]);
         app.activeDocument.pageItems.everyItem().select();
         //app.activeDocument.stories[0].tables[0].parent.select();
         var destFile = File(destFolder + "/" + myFiles[i].name + ".png");
         app.selection[0].exportFile(ExportFormat.PNG_FORMAT, destFile, false);  
         // here i need to correct code.
         sourceDoc.close(SaveOptions.NO);

  • How to link two text boxes so that text flows from one to the other.

    In Adobe Acrobat XI Pro,  I have managed to link two text boxes with JavaScript.
    I have deselected the "scroll long text" and selected auto text size.
    I have entered the script into the "custom keystroke script"
    if ( event.fieldFull || event.willCommit ) this.getField("Details2").setFocus();
    Now my problem is this works for IE but I can't get it to work with adobe reader or pdf expert on iPad.
    I need my forms to work with both, windows & ios.
    Any suggestions?

    See the following article:
    JavaScript - setFocus Method for tabbing to next form field
    And see if iOS can even handle the sample form.
    iOS and android devices are not a powerful as your desktop of laptop computer and have limited support for JavaScript within PDF forms. This limitation for specific apps ranges from none to quite a bit but not all JavaScript.

  • How to place two text box in the same line in PanelGroupLayout in ADF 11g

    I want to have two column of items in a PanelGroupLayout. Right now all the items are added in vertically one after the other. Please help me. I am using JDeveloper 11g.

    Hi,
    change layout of the PanelGroupLayout to horizontal. then insert inside this panel two PanelGroupLayouts and set their layout to verical
    regards,
    Branislav

  • How do I stop Firefox from auto-focusing on text boxes?

    How do I stop Firefox from auto-focusing on text boxes? Sometimes as a page is loading, I scroll down the page...only to have the page jump back to where there is a text box, with a blinking cursor, after the page is finished loading. It is an annoying feature and I want to turn it off.

    Some pages use an onload event to set the focus to a text area or search field.
    You can try NoScript to see if that blocks it.
    *NoScript: https://addons.mozilla.org/firefox/addon/noscript/

  • How to add the value of the two text boxes in the 3rd text box in ssrs table?

    Hi ,
    in my ssrs table i encountered a situation where i need to computing for the two text box values and i have to show that value in page header.
    for example i have to add the textbox9 value and textbox12 value then i have to show that value in the page header.
    Please help me with this requirement.
    Thanks in advance,
    Naveen

    Hi NaveenMSBI,
    According to your description, you want to sum the value of two textboxes, then display it in a page header textbox.
    Just PrajapatiNeta said, an expression in a page header or footer can refer to only one report item. So we can create a hidden textbox named textbox20 with the expression below in the report body:
    =reportitems!textbox9.Value + reportitems!textbox12.Value
    Then use the expression below in a page header textbox:
    =reportitems!textbox20.Value
    Besides, please note that in a page header or page footer section, only text boxes on the current page are available as a member of the ReportItems collection. For example, if ReportItems!textbox20.Value refers to a text box that only appears on the first
    page for a multipage data region, you can see a value only for the first page.
    Reference:
    ReportItems Collection References (Report Builder and SSRS)
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • In keynote - Leather Book theme - is there a way to remove the artwork in the middle of the cover page (between the two text boxes) (the squiggly thing)??

    I am trying to create a poster - in Keynote - transferring it to PDF then to JPEG so I can print it - and while I like the background in this Keynote theme (leather book) I can't seem to remove the artwork that is positioned between the two text boxes. Does anyone know how??? Can it even be done?

    I somehow ended up on creating a new master slide. I can FINALLY access the artwork - it has a box around it of x's - but I can't seem to do anything. Delete doesn't work. Trying to shrink the box doesn't work. I'm not getting a dialog box when I click on it that is specific to the x'ed area. It pertains to the full background page. I'm obviously missing something - the fact that I have never been in Keynote before may have something to do with it! :-)

  • How to add a text box in the layout (View)

    How to add a text box in the layout (View)

    Hi.
    Right Click in the RootUIElement container.
    Click Insert Element.
    Give Name: Input
    Type : Input Field.
    Press Enter.
    Regards
    Bala.

  • How do I remove text boxes from Pages

    I have an awful time with Pages on my lap top.  I am used to Appleworks  6.2 on my older desktop (PowerMac G4 / OS 10.4.11).  If I specify a US letter page I get that in Appleworks, it  is then 8.1/2" x 11", without running into pre-existing formats or other similar distractions. I can immediately type a neat business letter.
    Not with Pages.  On my MacBookAir, with Pages 4.3 and OS 10.8.4, I can type alright, but when I want to print what I typed, only a small part of what I typed shows up in in Print Preview of my typed page.  After a bit of backtracking,  I notice a blue-lined rectangle on my typed page containing the portion of my typing that appeared in that Print Preview.  It is apparently a self-formed "text box", that was not a part of my blank template page and was not inserted by me while or just before I typed.
    I did not find any way to delete the edges of that text box. The "delete" option under the pull down edit menu is blanked out.  If I click on the "Text box " symbol in the menu bar it does not let me switch off the text box, but instead gives me another text box inside the first one!  I suppose this is to allow user to print only a single keyboard stroke of the entire letter.  The "Inspector" seems to have no options to set text boxes.
    Pages "Help" Menu has nothing of how to delete a text box, or how to prevent it in the first place from screwing up what you have typed in such manner that it becomes unprintable.
    Similarly a small rectangular box formed on both the top and the bottom of each page (which could be a space reserved for a header or footer), but again I do not use these on my business letters, and they appear self-formed by Pages, and I would like to know how to prevent them, or delete them.
    In other words I like to get a blank page to start with, which will only set up and type what "I, THE  USER" enter on my keyboard. 
    Can anybody tell me how to this with Pages? 
    (PS. I can do it with even with Thunderbird !)

    1. Open a blank Word Processing template (they are listed in the Template Chooser sidebar), you have opened a Layout template that requires Textboxes for you to type into.
    2. To select a Textbox hold down the command key and click on its edge or lassoo it, then hit delete.
    3. If you don't want Headers or Footers, uncheck them in the Document Inspector
    4. Download the Pages09_UserGUide.pdf from under the Help menu and familiarise yourself with Pages' basics. Also look around your Menus and Inspectors which are laid out logically from left to right from broad to details.
    I suggest you click inside your textbox first go command a and copy the contents before you delete it and then paste that into a new Word Processing template.
    Peter

  • How do i link text boxes between pages in indesign cs5

    How do i linbk text boxes between pages in indesign cs5 please

    It is indeed may be someone has moved the discussions,
    Regarding your issue, Check this link:- http://helpx.adobe.com/indesign/using/threading-text.html
    If you could explain what exactly you are trying to do we may help better.

  • How to create a text box in ascreen painter?

    HI friends can anyone tell me how to create a text box in a screen painter?
    And attachment BROWSER like what we attach for any documents in over mail.
    Example when we click on browser the path of the computer has to be opened and by giving the document name attach and the document will be attached. Please tell me the procedure....
    Thks

    To get the best answers, I think you probably need to break down your post into several different one with a separate question in each, along with the business problem you are trying to solve... but here's a few pointers for you to research...
    Textbox - there's plenty of info in SDN on creating a custom control with a textbox e.g. Re: Text Editor on modulepool Screen and sample code in SAP too.
    Attachments - If this is for an email, then GUI_UPLOAD might help and the BCS class is the newer way to send messages... check out Re: Offline Approval: RBBP_NOTIFICATION_OFFAPP Vs RSWUWFMLEC for example... if this is an attachment for an SAP object such as an FI Document or Purchase Order, then the Generic Object Services (GOS) could be what you want e.g. https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0e6b0d95-0a01-0010-4696-ca0a48de5fb3
    Jonathan

  • In InDesign, how does one determine the pixel size of a text box? Specifically, we need to write text to specifications of 600 pixel width, and have no idea a) how to scale a text box to specific pixel width, b) how to

    This may be a basic question... but in InDesign, how does one determine the pixel size of a text box? Specifically, we need to write text to specifications of 600 pixel width, and have no idea a) how to scale a text box to specific pixel width, b) how to determine what word count we can fit in, and c) how to do it in a table? Thanks!

    Set your ruler increments to pixels Preferences>Units & Increments. You can fill the text box with placeholder text Type>Fill with Placeholder text and get a word count from the Info panel with Show Options turned on from the flyout.
    From the Transform panel you can set a text box's width and height

  • Wondering how to create a text box with variables...

    Hi everyone,
    I was wondering how to create a text box, that at the beginning of the presentation, the audience fills in regarding what they think constitutes the role they have been chosen for.
    I would like that same box to then appear at the end of the presentation, with the text they typed in at the beginning, so they can reflect on what they think now, and what they thought then. I understand this is done using variables, but i'm not 100% sure.
    I hope I've worded this okay!

    This screenshot shows the properties panel, Style tab for the TEB. I relabeled it to My_TEB, used the X button  to create a user variable v_choice that will replace the generic Text_Entry_Box_1/
    This is the properties panel of a Shape, I went in Edit mode (double clicking)to make the Character section appear, where you find the X button. It opens the dialog box 'Insert Variable' and you can choose the var associated with the TEB. The Maximum Length will define how many characters will be displayed, the value of a variable has maximum 256 characters.

  • Compare two text box values????

    Hello All,
    I do have one logic, but not sure where to write it so want your guys help for the same.
    The logic is:-
    if (&P13_NEW_PASSWORD. == &P13_CONFIRM_NEW_PASSWORD.) then
    insert into tbuser (password) values (&P13_NEW_PASSWORD.);
    else
    dbms_output.line_('Both the text boxes should be same!!')
    P13_NEW_PASSWORD and P13_CONFIRM_NEW_PASSWORD are two text boxes, where in above statment I'm comparing two text box values, if yes than insert that values into the DB tables otherwise displaying else messges.
    so can anybody tell me where should i write the above logic to make it work perfect..!!!
    thanks
    regards,
    Kumar

    Kumar,
    I'm glad you asked! Here's a great blog post on a custom auth scheme that hashes passwords:
    http://djmein.blogspot.com/2007/07/custom-authentication-authorisation.html
    I would suggest a few changes to the "get_hash" function. First, the DBMS_OBFUSCATION_TOOLKIT has been deprecated in favor of DBMS_CRYPTO:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
    http://www.psoug.org/reference/dbms_crypto.html
    DBMS_CRYPTO offers Message Authentication Code (MAC) functions which are keyed hashes. If you use a non-keyed function such as MD5 (which is VERY well known), someone can easily generate a table of all possible passwords within reason and their matching hash, which essentially allows them to get the passwords. MAC functions take in the data (password in this case) and a key. You can probably just use a big random string for your key. Now someone would need to the key as well to generate a hash table. In short, just use DBMS_CRYPTO.MAC where Duncan used DBMS_OBFUSCATION_TOOLKIT.md5.
    Tyler

  • How can I embed text box on photos?

    How can I embed text box on photos?

      Did this software slow down the system in your experience?
    No, not afaik. It behaves like any other external editor. You do not need to have it running in the background all the time. Just activate it from the contextual menu after ctrl-clicking the image you want to annotate and select "Edit with plug-in -> BorderFX" from the pop-up menu (or Photos ->  Edit with plug-in -> BorderFX) .
    Corky02 really said it all - the only draw back is that this plug-in really is more like an export plug-in and the edited version will create a new master.
    Regards
    Léonie

Maybe you are looking for

  • HT204380 Can I broadcast live on a web site using my iphone4 or ipad2?

    Is there any way that I can Broadcast Live using my iPad2 or my iPhone 4. Are there any apps that I can purchase to do so?

  • 10.3.9 minimum requirement

    I'm finally going to take the plunge and get an iPod. While I am very disappointed with not having Firewire, I do appreciate the new thinner design. My question is, I see the minimum system requirement is OS X 10.3.9 - I'm fine, as my Powerbook G4 is

  • BPEL 11g NonBlocking Invoke

    I have parallel flow in my BPEL. I set nonblocking to true on one of partner links which is being called from flow branch.This partner link call Sync service which will return resp in few secs. When I test this flow, I can see audit message saying pa

  • Material Components of a PO in BI DataSources

    In which DataSources we find the Material Compoments of a Open PO (Sub-Contracting). Thanks,

  • How can I set restrictions on YouTube in IOS6?

    Since IOS6 came out, YouTube does not appear to be an app I can restrict in "settings". I would like to restrict it or be able to restrict certain content.