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. How can i remain focus on the listview [modified]

How can i remain focus on the listview [modified]

Scheduled Pinned Locked Moved C#
helpquestion
2 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.
  • N Offline
    N Offline
    Naveed727
    wrote on last edited by
    #1

    I got a situation an want to solve it if any body have any idea then pleas share it with me. The situation is below I have two panels panel1 and panel2 in panel1 i have number of buttons and in panel2 i have one list view in which some file are shown. The thing i want to do when i press any button from panel1 and drag at to panel2 when i drag it any file in pane2 according to the button which i drag some work should have to be done one the file on which i drag the button. I tried it by many ways but not succeed because when i press my mouse on any button and going drag to list view i can not got Focus of list view and can not get the location on which file the drag is over. Help me out and thanks in advance.

    modified on Tuesday, May 6, 2008 11:27 AM

    L 1 Reply Last reply
    0
    • N Naveed727

      I got a situation an want to solve it if any body have any idea then pleas share it with me. The situation is below I have two panels panel1 and panel2 in panel1 i have number of buttons and in panel2 i have one list view in which some file are shown. The thing i want to do when i press any button from panel1 and drag at to panel2 when i drag it any file in pane2 according to the button which i drag some work should have to be done one the file on which i drag the button. I tried it by many ways but not succeed because when i press my mouse on any button and going drag to list view i can not got Focus of list view and can not get the location on which file the drag is over. Help me out and thanks in advance.

      modified on Tuesday, May 6, 2008 11:27 AM

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      It has been awhile since I coded any drag-and-drop events but there are things you must do to have it happen correctly. I believe the issue goes beyond getting focus for your listview. Panel1 I believe must be set to that you catch the beginning of the drag event. From the event you can review what object is being chosen and approve or deny it. If approved you must then put that object (or representative of it) in the clipboard. Now in Panel2 -or- in your ListView you need to capture the dragover(?) or dragenter(?) event. Basically it is raised any time an item is dragged over it. If you do not catch this event then you will never be allowed to drop anything. In the event handler you would then interrogate the clipboard to determine if the object type is what you would allow..and if so return the indicator in the event args that you will accept the object. Finally your drop event either in Panel2 or your ListView (your broken english was readable but not clear as to whether you are dropping in the second panel or your listview). When you get the event, you can then 1) pull the object from the clipboard 2) get out of it the items/files/work you need to get out of it 3) do your population Hope this helps. I'd suggest you google Coding Drag And Drop to see if you can find more details that can help you solve your problem. You will especially need it when adding the object to the clipboard. I remember havin one object that I could not add and don't remember the attributes that had to be added to make it addable.

      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