Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. canvas.Focus does not unfocus textbox

canvas.Focus does not unfocus textbox

Scheduled Pinned Locked Moved C#
graphicshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pauwels Bart
    wrote on last edited by
    #1

    Hi, I have kind of a drawingprogram. I display an image in a canvas and on that canvas with image the user can place multiple custom controls (drawing area's derived from the canvas class) in which the user can draw figures and text. To input the text, I initialize a textbox. When clicking outside the textbox, that textbox must disappear and the text is shown as formatted text (drawingContext.draw) on the control. I do that with textBox.LostFocus and textBox.LostKeyboardFocus. Problem is that when I click outside the textbox, the textbox does not lose focus! When clicking on the canvas, I use this.focus(). The code when clicking the canvas is called and it passes the focus command but the textbox does not lose focus. The code to hide the textbox and display the text as formatted text works. Anybody has an idea? Maybe I missed something in MSDN that I need to do. Thanks, Bart

    R 1 Reply Last reply
    0
    • P Pauwels Bart

      Hi, I have kind of a drawingprogram. I display an image in a canvas and on that canvas with image the user can place multiple custom controls (drawing area's derived from the canvas class) in which the user can draw figures and text. To input the text, I initialize a textbox. When clicking outside the textbox, that textbox must disappear and the text is shown as formatted text (drawingContext.draw) on the control. I do that with textBox.LostFocus and textBox.LostKeyboardFocus. Problem is that when I click outside the textbox, the textbox does not lose focus! When clicking on the canvas, I use this.focus(). The code when clicking the canvas is called and it passes the focus command but the textbox does not lose focus. The code to hide the textbox and display the text as formatted text works. Anybody has an idea? Maybe I missed something in MSDN that I need to do. Thanks, Bart

      R Offline
      R Offline
      Roman Lerman
      wrote on last edited by
      #2

      My idea is to set Canvas.Focusable Property to True ;)

      P 1 Reply Last reply
      0
      • R Roman Lerman

        My idea is to set Canvas.Focusable Property to True ;)

        P Offline
        P Offline
        Pauwels Bart
        wrote on last edited by
        #3

        So easy! Now it works perfect. I never stood still that canvas was standard not focusable. Thanks very much!!!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups