CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Location
    Cheshire, UK
    Posts
    4

    Cut & Copy Toolbar problem

    We have an app with Cut, Copy & Paste buttons on a JToolbar. However, when text in textfield selected and press Copy or Cut textfield loses focus and nothing cut/copied. This works OK from the Edit menu though. How do we stop the toolbar stealing the focus/selection of the textfields ?


  2. #2
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: Cut & Copy Toolbar problem

    Hi there
    Maybe you could try the method
    yourJTextfield.requestFocus();
    Try to use this on the line before you
    cut,copy or paste. This will be in your event capturing method.
    I think you will find that the text is still
    selected when the JTextfield gets the focus back.

    Good luck
    Phill.


  3. #3
    Join Date
    Feb 2002
    Location
    India
    Posts
    37

    Re: Cut & Copy Toolbar problem

    Hi,
    You have said that it is working fine from the menu. Can i have some help regarding that since i face the same problem even when i do cut/copy from Menu action.
    I've also tried giving request focus to the JTextFiedl in the menu action listener for cut/copy. But still i have the problem of cut/copy.
    If some text is there already the whole text is being copied or cut even if i had selected only some part of the text. Is there any solution for this.

    Thanks,
    Manoj.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured