How to add a button in ClistCtrl?
-
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
-
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
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. <
-
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
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 )