-
July 10th, 2013, 08:11 AM
#1
[RESOLVED] C++ dialog listbox display outside the dialogbox
I'm trying to duplicate a listbox I saw in another application. It
looks like this:
The listbox is hidden until the ownerdrawn pushbutton is selected. So
far so good, but my listbox is displayed only up to the edge of the
dialog box which means it shows only two lines and doesn't extend into the
desktop area. I'd expect this default behavior due to the OS clipping
applications so they aren't overwriting one another.
But how did the original dialog get around this? I tried a few options
with WS_CLIP... SetWindowPos(HWND_TOPMOST... and also creating the
listbox at INITDIALOG time and have the parent be the desktop, but
so far it displays just the two lines. Any idea on this?
Thanks
René
-
July 10th, 2013, 11:55 AM
#2
Re: C++ dialog listbox display outside the dialogbox
This combobox has following styles:
WS_CHILDWINDOW
WS_VISIBLE
WS_TABSTOP
CBS_DROPDOWNLIST
CBS_OWNERDRAWFIXED
CBS_SORT
CBS_HASSTRINGS
And you can increase the siye of its dropdown listbox in resource editor: xlick with the mouse on its "arrow" and resiye the listbox.
Victor Nijegorodov
-
July 10th, 2013, 11:56 AM
#3
Re: C++ dialog listbox display outside the dialogbox
It seems like just a popup window, not the dialog's child.
Best regards,
Igor
-
July 10th, 2013, 12:01 PM
#4
Re: C++ dialog listbox display outside the dialogbox
Originally Posted by Igor Vartanov
It seems like just a popup window, not the dialog's child.
Good point!
@OP: I guess Spy++ could help!
Victor Nijegorodov
-
July 11th, 2013, 06:16 AM
#5
Re: C++ dialog listbox display outside the dialogbox
Thanks guys -- I'll try Mr. Vartanov's idea of WS_POPUP first. That makes sense to me and I don't know why I didn't think of that earlier. Failing that, I'll try VictorN's suggestion of WS_CHILDWINDOW style, but the POPUP should do it. Thanks again --- René
-
July 11th, 2013, 07:28 AM
#6
Re: C++ dialog listbox display outside the dialogbox
if you want the window to extend out of the dialog... it cannot be a child of the dialog.
I'm guessing you currently have the listbox as part of the dialog template and you are changing the WS_VISIBLE style of the listbox ? This won't work, you'll need to dynamically create a WS_POPUP listbox (WS_POPUP and WS_CHILD are exclusive).
-
July 12th, 2013, 09:54 AM
#7
Re: C++ dialog listbox display outside the dialogbox
Originally Posted by OReubens
if you want the window to extend out of the dialog... it cannot be a child of the dialog.
I'm guessing you currently have the listbox as part of the dialog template and you are changing the WS_VISIBLE style of the listbox ? This won't work, you'll need to dynamically create a WS_POPUP listbox (WS_POPUP and WS_CHILD are exclusive).
OReubens
Yes indeed. The earlier post from Igor Vartanov pointed me in the right direction.
The listbox is not a child of the main dialog in this case. The .RC looks something like:
IDD_LISTDIALOG DIALOG 30, 80, 130, 120
STYLE WS_POPUP | DS_3DLOOK | WS_VISIBLE
FONT 8, "HELV"
BEGIN
LISTBOX IDC_LISTBOX, 0, 0, 130, 120,
LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_BORDER |
WS_VSCROLL | WS_GROUP | WS_TABSTOP | LBS_DISABLENOSCROLL
END
And from the parent dialog (hwnd) call it:
case WM_INITDIALOG:
hLstBx = CreateDialog(_hInstance, MAKEINTRESOURCE(IDD_LISTDIALOG), hwnd, (DLGPROC) ModelessDialogProc);
ShowWindow(hLstBx, SW_HIDE);
SetProp(hwnd, SPEEDLST, (HANDLE) hLstBx);
When the ownerdrawn pushbutton is selected we do a SetWindowPos() to keep the
control in the same area relative to the pushbutton and just do a SW_SHOW.
Worked fine once I got over trying to make the listbox part of the original dialog box !
René
-
August 3rd, 2013, 02:23 AM
#8
Re: C++ dialog listbox display outside the dialogbox
It's look like a popup window.The scroll bar and scroll pane are available.You will try to change the coding.
Tags for this Thread
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
|