VC5:Adding a listbox to property page (MFC dialog-based app) 
Author Message
 VC5:Adding a listbox to property page (MFC dialog-based app)

Maybe this might help:
You first can attempt the Listbox in CPropertyPage::OnInitDialog. The pages
are not initialized when your Dialog shows up, they get initialized when
the page shows up.
Greetings Mike



Quote:

>97.5.2

>Can anyone help me in using a listbox (CListBox) in a property page?
>I can add the listbox from the resource editor and compile without
>error, but when I click inside this listbox an assertion error occurs.
>Also if I attempt to manipulate this listbox before, upon creation
>(CPropertySheet::OnInitDialog), or after (CPropertySheet::DoModal and
>upon return) an assertion error occurs.  I've posted this incident to
>Microsoft finding out no one had an answer, it's been days now and no
>response.  Here's all I can give you:

>Application:VC5 MFC dialog-based with OLE control
>Property Pages: 3 (3rd page giving me problems w/listbox)
>Listbox flags: (defaults) or by second attempt (owner draw fixed, has
> strings, vert scroll, no integral height, sort, border, notify)

>---------------------------------------------------------------------------
-
>-----
>This assertion applies to Incident 2 below:
>Assertion error example if listbox member functions called:
>Assertion error occurs in AFXWIN2.INL, line 685:
>        _AFXWIN _INLINE int CListBox::AddString(LPCTSTR lpszItem)
> { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(
>     m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
>---------------------------------------------------------------------------
-
>-----

>Incident 1 (no manipulation to listbox, just added to property page):
> User presses button to bring up property sheet.  User may
> tab through pages without error.  If user clicks on listbox,
> assertion error occurs.

>Incident 2 (manipulation of listbox by adding strings or any other calls
>to CListBox -- before, upon, and after property sheet and pages are
>initialized and variables created):
> User presses button to bring up property sheet and assertion
> error occurs.

>I could place my code here, but it's best if I give you step-by step:

>1] Create an MFC dialog-based app with or w/o OLE
>2] Create property sheet and pages, one with a listbox
>3] Add button to main windows (dialog box) to display property sheet
>4] Compile and run
>5] Display property sheet
>6] Select focus (click) on listbox (INCIDENT 1 occurs)
>7] Back to compiler: initialize listbox as you see fit anywhere in
> property sheet, property page, or main windows (dialog) code
> NOTE: any function calls at this point, AFXWIN2.INL will give
> an assertion error
>8] Compile and run
>9] Display property sheet by clicking button (INCIDENT 2 occurs)

>That's all I can give you onmy incident.  I don't understand why, but
>I use a CComboBox in my main dialog box and it works fine.  It's only
>when I use a property sheet/page that I get errors.



Tue, 19 Oct 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Adding Another MFC Dialog to the Dialog base application

2. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

3. Property sheet control in dialog based app

4. Adjusting Property Pages Within a Dialog App

5. Adding a minimize button to an existing dialog based app

6. adding a Minimise button to a dialog-based app

7. Adding a status bar to a Dialog-based App

8. trying to add menu to dialog based app

9. Newbie : Adding Menu Bar and Tool Bar to Dialog Based App

10. adding an icon to a propsheet dialog-based app

11. add help files to dialog-based app

12. How to add a page to Display Property Page

 

 
Powered by phpBB® Forum Software