-
October 17th, 2011, 03:03 PM
#1
Need Listbox to not be cropped when displayed
Hi,
I have a GUI with several controls. One of them is a ListBox that is displayed occasionally. When it is displayed, it is cropped by it's siblings windows, which is an EditBox and a window that is a sibling of it's parent. I have attached snapshots of the screen before the ListBox is displayed and after it is displayed. When the ListBox is displayed, I want it displayed fully and not cropped at all.
When displaying the list box, I tried calling "BringWindowToTop" to assure that the ListBox will be displayed fully, but it is not. Is there any other call I can make to force the ListBox to be displayed fully and not be cropped?
Thank you,
Rakefet
-
October 20th, 2011, 02:06 AM
#2
Re: Need Listbox to not be cropped when displayed
Try to use SetWindowPos with HWND_TOP as parameter.
-
October 20th, 2011, 03:40 AM
#3
Re: Need Listbox to not be cropped when displayed
AFAIK, BringWindowToTop has the same effect like SetWindowPos with HWND_TOP.
Well, never know... a try is not a mistake.
-
October 20th, 2011, 08:32 PM
#4
Re: Need Listbox to not be cropped when displayed
Yes, the SetWindowsPos function didn't help the problem.
But from debugging I see that after I display the ListBox, the other controls are getting WM_PAINT messages and so they are re=painting over the ListBox. Is there any way I can prevent the other controls from getting these WM_PAINT messages?
Thank you,
Rakefet
-
October 21st, 2011, 03:06 AM
#5
Re: Need Listbox to not be cropped when displayed
At last, everything is possible but "preventing the other controls from getting these WM_PAINT" is not a good practical solution.
Consider the following alternatives:
- rearrange the controls in order to prevent overlapping, or
- put the listbox in a top-level frame, or
- replace the listbox with a combobox.
I would like to suggest #3.
-
October 21st, 2011, 03:42 AM
#6
Re: Need Listbox to not be cropped when displayed
I forgot to mention the alternative #4: playing with WS_CLIPSIBLINGS style.
It may work but IMO, #3 is still better.
It seems that you have a combination of an edit control and an occasionally displayed listbox. This is exactly the behavior of a combobox.
Once the dropdown list of a combobox is a top-level window, it does not need any other action from your side to make it visible over other controls.
-
October 21st, 2011, 12:52 PM
#7
Re: Need Listbox to not be cropped when displayed
Thank you very much for the suggestions. I originally used a ComboBox but I couldn't dynamically set the text in the EditBox part of the control. I have a previous post about that. When the user selected an item from the ComboBox, I wanted to then set the text to whatever I wanted. But the control set it to whatever was selected in the ComboBox. Interestingly, the ComboBox had no problem with being cropped. It was always displayed properly.
Thanks,
Rakefet
-
October 22nd, 2011, 06:10 AM
#8
Re: Need Listbox to not be cropped when displayed
Originally Posted by rzdybel
Interestingly, the ComboBox had no problem with being cropped. It was always displayed properly.
As I already said, the dropdown list of a combobox is a top-most top-level window. For that reason, it stays always on top.
Originally Posted by rzdybel
I originally used a ComboBox but I couldn't dynamically set the text in the EditBox part of the control. I have a previous post about that. When the user selected an item from the ComboBox, I wanted to then set the text to whatever I wanted. But the control set it to whatever was selected in the ComboBox.
As an end user, I would be enough happy to have a standard combobox and not one with "special effects". This one may at least annoy me.
Although, (almost) everything is possible and you can catch that dropdown list window, subclass it then probably, can do what your muscles want.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|