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 / C++ / MFC
  4. How to add a button in ClistCtrl?

How to add a button in ClistCtrl?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 3 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.
  • G Offline
    G Offline
    Gokul_md
    wrote on last edited by
    #1

    Hi i have an Extended ClistCtrl, in which i want to insert a button at the bottom right. i can able to create the button using the nelwo code , lButton=new CButton(); lButton->Create(_T("Select All & Next"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON |BS_MULTILINE, CRect(520,280,600,320), this, IDC_BUTTON1); lButton->ShowWindow(SW_SHOWNORMAL); but when i am scrolling the list control the button image also getting painted in various places and flickering . how to handle this? Thanks Gokul

    C H 2 Replies Last reply
    0
    • G Gokul_md

      Hi i have an Extended ClistCtrl, in which i want to insert a button at the bottom right. i can able to create the button using the nelwo code , lButton=new CButton(); lButton->Create(_T("Select All & Next"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON |BS_MULTILINE, CRect(520,280,600,320), this, IDC_BUTTON1); lButton->ShowWindow(SW_SHOWNORMAL); but when i am scrolling the list control the button image also getting painted in various places and flickering . how to handle this? Thanks Gokul

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Why on Earth do you want to put a button in the corner of a list control? :) Anyways, i doubt there is a simple and easy way to do it, is the parent of the button the same as the parent of the list control or is it the list control itself? The simplest thing you could try is to set the WS_CLIPCHILDREN style (if the list is the parent of the buttton) or WS_CLIPSIBLINGS style (if the parent of the list is the parent of the button), but i doubt it will work and setting the WS_CLIPCHILDREN style causes redraw animalies in the header control if you have one. You could try decreasing the client area of the list control and put the button on it, this works only if the list is not the parent of the button, you have to make the list not draw onto the button or at least make the button get drawn when the list's nonclient area is drawn, there's a simple way to do this, but i can't remember what now, i think you would need to set WS_TRANSPARENT on the list and ensure that the button is under the list in the Z-order, but i am not sure. The drawback here is that you can't have list items in the non-client area so if you insist on having the button sitting among list items, this won't do for you. Another thing you could maybe try is to overwrite the scroll-message handlers in the list, disable the redrawing of the list (SetRedraw[^]), calling the base scroll method, then re-enabling redrawing and have the list redraw it self, you might need to explicitly clip the button from the invalidated area. These are just vague ideas, dunno if any of these would work of suit your needs.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

      1 Reply Last reply
      0
      • G Gokul_md

        Hi i have an Extended ClistCtrl, in which i want to insert a button at the bottom right. i can able to create the button using the nelwo code , lButton=new CButton(); lButton->Create(_T("Select All & Next"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON |BS_MULTILINE, CRect(520,280,600,320), this, IDC_BUTTON1); lButton->ShowWindow(SW_SHOWNORMAL); but when i am scrolling the list control the button image also getting painted in various places and flickering . how to handle this? Thanks Gokul

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        And see http://www.codeproject.com/KB/list/xlistctrl.aspx[^].

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        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