• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

CListCtrl Problem

I have created several buttons in my Main Window that I use to select CListControls.  When I select a button a list control is created.  The control is sizeable. When I attempt to resize the control my buttons become visible through the  list control.  Also if the mouse is pressed within the list control in an area where a button is being covered the button is selected.  How can I stop this from happening.  I've tried several styles but nothing worked.
0
sjm
Asked:
sjm
  • 10
  • 5
  • 4
  • +1
1 Solution
 
RONSLOWCommented:
You need to change the Z ordering of the list control (probably in its WM_CREATE handler).

It is being created UNDER the buttons (but ON TOP OF the window background).  Use SetWindowPos to move it to the front of the Z order.

PS: Where are you creating the List Control - in a CFormView? or in a CDialog?

0
 
sjmAuthor Commented:
RONSLOW,
                    Both the buttons and  CList controls are being created in my CView.  How does the Z order affect the way the other controls bleed through the list control?  The list control is being created over the buttons in my view.  When I try to move or resize the list control the buttons below the list control are  showing through and they are being enabled when I try to select an item in the list control that is ontop of a button.
0
 
RONSLOWCommented:
The only way they would be showing through and responding to mouse actions is if they are on TOP of the List Control.

Can you e-mail me a screen-shot of this?  And some code.  I am at mailto:Roger_Onslow@compsys.com.au

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
RONSLOWCommented:
Sean

The problem is that you are creating your buttons etc in OnShowWindow - that means every time the view is covered or exposed, you'll create ANOTHER copy of the button.  That includes when you resize you list control.  In otherwords, its not the original buttons showing through, but NEW buttons being created on top !!

I'd move the creation of your buttons etc from OnShowWindow to your OnCreate or OnInitialUpdate handler.  That way, they'll just get created when the view is first created, and not re-created everytime something covers or exposes your view (you'll end up with LOTS of overlaid buttons that way).

Good luck !!!

Roger
0
 
sjmAuthor Commented:
Roger,

     I moved all my buttons to OnInitialUpdate and my problem as not changed.  I am e-mailing you several screen shots to show you the problem.
0
 
sjmAuthor Commented:
Sorry RONSLOW,  I waited a week for a responce.  I realy need an answer to this problem!!:<
0
 
AVaulinCommented:
I had problem like your and solved it by calling EnableWindow(FALSE) for each control (in your case buttons). To return normal button work call EnableWindow(TRUE).
Good luck.
0
 
RONSLOWCommented:
I haven't seen your code since you made the changes - please send.

It is interesting that only the BUTTONS show through.

0
 
sjmAuthor Commented:
Avaulin

     Using EnableWindow(FALSE) did not work.  The disabled button still appeared through the list control.  Give me your E-Mail address and I will send you a copy of my code and  screen shots of the problem.

RONSLOW,

     I am sending the revised code I tried. and a screen shot of the above.
0
 
AVaulinCommented:
My address is av@protec.kiev.ua
0
 
AVaulinCommented:
This is really interest problem. I can't find it solving. But I can propose you another way: you can create non-modal dialog and place only one ListCtrl control in it. I hope it must help.
0
 
sjmAuthor Commented:
Sorry AVaulin, I need this Control to work outside a dialog.  And I've increased the points to 100 so I hope some one can help me solve this problem.
0
 
sjmAuthor Commented:
Adjusted points to 100
0
 
mrosenCommented:
I have this problem too. I assume you're handling the sizing in OnSize. You are probably then recalculating the size with GetDlgItem()->MoveWindow, too. If not, this is definately a good way to go about it. You should then call the InvalidateRect() command for the window or dialog that holds all of your controls. This will eliminate the problem.
0
 
sjmAuthor Commented:
mrosen,
      I have been trying to create the CList controls as child windows with out having to create a window inclosing the controls.  This hasn't worked as you can tell by the comments above.  If I have to create the control inside a window and have that window work as a popup window could you please provide the correct code.  I've tried to use CreateEx but I can't get a handle to the frame window client area and I get an assertion error for not having WS_CHILD as a style in my CView. When I try to use a new CView class I get an error saying can't access protected constructor.  I'm sure I'm not doing it correctly.
0
 
mrosenCommented:
Ok. I'm a bit unclear about what's going on. Here are the two possible things I think you're doing:

Two or more listctrl at a time:
Here you should cheat and make a dialog box. In your dialog box properties, second tab, choose the border as resizing. Then create the basic format of your dialog box. In OnSize, you should call GetClientRect to figure out the new size and resize all of the dialog controls using MoveWindow (with a final InvalidateRect), like I said in my proposed answer.

Using buttons to toggle between listctrls:
This is a lot of explanation. Please tell me if this is what you want to do. I have a project that does this, and I can send it to you ant explain this to you if you want.
0
 
sjmAuthor Commented:
mrosen,
     Here is what i'm trying to do.  I have seven CButton controls that are created in my CView class and appear in the main view.  Each of these buttons control a CListControl.  A user should be able to select any or all of these buttons and any or all of the CListControls should be visible.  The user should be able to tab through the CListControls and be able to minimize or maximize an individual ClistControl.  The problem I'm getting is that when a button is selected and a CListControl appears, any attemp to use this control such as resizing or moving this control causes the CButtons behind the control to appear through the control.  Any attempt to click inside the control does the same thing.  It would seem to me that the only solution is to create multiple CView windows for each control and add the controls to each window.  But I don't quite know how to do this and I was trying to find out if some one has some code that will do this.  The problem with using a non-modal dialog is the amount of overhead, the calls to movewindow and the inability to use all of the dialog for the control.  I would rather use CreateEx if there is no way to just create a ClistControl as a true child window.  If you would like I can send you a screen shot of my app showing you what happens when I try to resize the CListControl.  Just give me your e-mail address.  I can also send you the code of my CView CLass to see what I might be doing wrong.
0
 
sjmAuthor Commented:
mrosen,
     I made a big mistake I should have given your ideas a try before grading you.  Using adialog box with the CListCtrl was the right way to go.  Is there any way I can change the grade from F to A?
0
 
AVaulinCommented:
This was my idea. If you agree with this let me leave you empty answer for evaluation.
0
 
sjmAuthor Commented:
I"m sorry Avaulin my mistake. You were the first to come up with the idea and you should be the one who is given the points.  I'm sorry I didn't try this idea before.  But the system won't let me give you a grade.  The question is still listed as unlocked.
0
 
AVaulinCommented:
(Empty)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 10
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now