Click here to Skip to main content
15,918,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionis there any way to pass a double's array like a paramenter by reference to a function? Pin
27-Mar-02 0:43
suss27-Mar-02 0:43 
AnswerRe: is there any way to pass a double's array like a paramenter by reference to a function? Pin
Tomasz Sowinski27-Mar-02 1:28
Tomasz Sowinski27-Mar-02 1:28 
GeneralRe: is there any way to pass a double's array like a paramenter by reference to a function? Pin
1-Apr-02 0:16
suss1-Apr-02 0:16 
GeneralHGLOBAL IStream IPicture... AAAAAH ! Pin
Braulio Dez27-Mar-02 0:04
Braulio Dez27-Mar-02 0:04 
GeneralRe: HGLOBAL IStream IPicture... AAAAAH ! Pin
Paul M Watt27-Mar-02 4:00
mentorPaul M Watt27-Mar-02 4:00 
GeneralRe: HGLOBAL IStream IPicture... AAAAAH ! Pin
Braulio Dez27-Mar-02 4:05
Braulio Dez27-Mar-02 4:05 
GeneralRe: HGLOBAL IStream IPicture... AAAAAH ! Pin
Paul M Watt27-Mar-02 4:48
mentorPaul M Watt27-Mar-02 4:48 
GeneralControl Toolbars with Owner Drawn Combo Boxes Pin
John Clump26-Mar-02 23:40
John Clump26-Mar-02 23:40 
Hi everyone. I have a dialog with a control toolbar, which I have been able to successfully create. It has 2 combo boxes, both were simple combo boxes, and it worked fine. Then, I made one of the combo boxes a CFontPreviewCombo (which is a combo box which displays all available system fonts, which is a new control added to CodeProject, by Chris Losinger). I did this by changing the type from CComboBox to CFontPreviewCombo, and it compiled and ran fine. It did display the fonts in the combo box, but box itself did not draw properly. I realized it was supposed to be owner drawn variable, so I made it owner drawn variable by using the CBS_OWNERDRAWVARIABLE style.

When I did that, I got a daocore.cpp, line 42. It asserts on the cToolBar.m_cboFont.Create() line, when the combo box is created. It does not assert when not owner drawn, but does when it is.

I have my combo box code below, I am doing this in the OnCreate() of the dialog. I was told this was the right place to put it, but I am not completely sure, I have to admit I am new to manipulating toolbars directly.

<br />
int CDlgReport::OnCreate(LPCREATESTRUCT lpCreateStruct) <br />
{<br />
	if (CDialog::OnCreate(lpCreateStruct) == -1)<br />
		return -1;<br />
<br />
	CRect rect;<br />
    /////////////////////////////////////////<br />
    //Body of On Create goes here<br />
<br />
<br />
    //add the tool bar to the dialog<br />
    cToolBar.Create(this);<br />
    cToolBar.LoadToolBar(IDR_TBR_REPORT);<br />
<br />
    #define SNAP_WIDTH_FONT_SIZE 50 //the width of the combo box<br />
    #define SNAP_WIDTH_FONT 150 //the width of the combo box<br />
<br />
	////////////////////////<br />
	// FONT COMBO BOX<br />
<br />
    //next convert that button to a seperator and get its position<br />
    cToolBar.SetButtonInfo(0, ID_TBR_REPORT_CBO_FONT, TBBS_SEPARATOR,<br />
        SNAP_WIDTH_FONT);<br />
    cToolBar.GetItemRect(0, &rect);<br />
<br />
    //expand the rectangle to allow the combo box room to drop down<br />
    rect.top+=2;<br />
    rect.bottom += 200;<br />
<br />
    // then create the combo box and show it<br />
<br />
<br />
    /* THIS CODE WORKS, NOT OWNER DRAWN <br />
	if (!cToolBar.m_cboFont.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL| <br />
                                       CBS_DROPDOWNLIST|CBS_HASSTRINGS | CBS_SORT,<br />
                                       rect, &cToolBar, IDC_CBO_FONT))<br />
    {<br />
        TRACE0("Failed to create combo-box\n");<br />
        return FALSE;<br />
    }<br />
    */<br />
    <br />
	/* THIS CODE ASSERTS, OWNER DRAWN */<br />
	if (!cToolBar.m_cboFont.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL| CBS_OWNERDRAWVARIABLE |<br />
                                       CBS_DROPDOWNLIST|CBS_HASSTRINGS | CBS_SORT,<br />
                                       rect, &cToolBar, IDC_CBO_FONT))<br />
    {<br />
        TRACE0("Failed to create combo-box\n");<br />
        return FALSE;<br />
    }<br />
	<br />
	<br />
	<br />
	cToolBar.m_cboFont.SetFont(cToolBar.GetFont());<br />
	cToolBar.m_cboFont.ShowWindow(SW_SHOW);<br />
<br />
    //fill the font face combo box<br />
    cToolBar.m_cboFont.m_style = CFontPreviewCombo::NAME_GUI_FONT;<br />
	cToolBar.m_cboFont.Init();<br />
<br />
<br />
	////////////////////////<br />
	// FONT SIZE COMBO BOX<br />
<br />
/* THIS IS THE SECOND, NON-OWNER DRAWN COMBO BOX, I INCLUDED<br />
THIS JUST IN CASE, THIS WORKS */<br />
    //next convert that button to a seperator and get its position<br />
    cToolBar.SetButtonInfo(1, ID_TBR_REPORT_CBO_FONT_SIZE, TBBS_SEPARATOR,<br />
        SNAP_WIDTH_FONT_SIZE);<br />
    cToolBar.GetItemRect(1, &rect);<br />
<br />
    //expand the rectangle to allow the combo box room to drop down<br />
    rect.top+=2;<br />
    rect.bottom += 200;<br />
<br />
    // then .Create the combo box and show it<br />
    if (!cToolBar.m_cboFontSize.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL| <br />
                                       CBS_DROPDOWNLIST|CBS_HASSTRINGS,<br />
                                       rect, &cToolBar, IDC_CBO_FONT_SIZE))<br />
    {<br />
        TRACE0("Failed to create combo-box\n");<br />
        return FALSE;<br />
    }<br />
    cToolBar.m_cboFontSize.SetFont(cToolBar.GetFont());<br />
    cToolBar.m_cboFontSize.ShowWindow(SW_SHOW);<br />
<br />
    //fill the font size combo box<br />
    cToolBar.m_cboFontSize.AddString("1");<br />
    cToolBar.m_cboFontSize.AddString("2");<br />
    cToolBar.m_cboFontSize.AddString("3");<br />
    cToolBar.m_cboFontSize.AddString("4");<br />
    cToolBar.m_cboFontSize.AddString("5");<br />
    cToolBar.m_cboFontSize.AddString("6");<br />
    cToolBar.m_cboFontSize.AddString("7");<br />
    cToolBar.m_cboFontSize.SetCurSel(0);<br />
		<br />
	return 0;<br />
}<br />


If I am not specific enough, I can provide more code. I hope I explained this correctly.

Thanks in advance!Smile | :)
GeneralRe: Control Toolbars with Owner Drawn Combo Boxes Pin
wangyiming27-Mar-02 19:39
wangyiming27-Mar-02 19:39 
GeneralRe: Control Toolbars with Owner Drawn Combo Boxes Pin
John Clump27-Mar-02 21:13
John Clump27-Mar-02 21:13 
GeneralRe: Control Toolbars with Owner Drawn Combo Boxes Pin
wangyiming28-Mar-02 17:17
wangyiming28-Mar-02 17:17 
GeneralMultible tables in one dialog Pin
26-Mar-02 23:32
suss26-Mar-02 23:32 
Generalusing DLL error Pin
26-Mar-02 23:05
suss26-Mar-02 23:05 
GeneralRe: using DLL error Pin
Tomasz Sowinski26-Mar-02 23:05
Tomasz Sowinski26-Mar-02 23:05 
GeneralRe: using DLL error Pin
Jack Hui27-Mar-02 5:21
Jack Hui27-Mar-02 5:21 
GeneralPressing key stuff problems... Pin
Rickard Andersson2026-Mar-02 22:59
Rickard Andersson2026-Mar-02 22:59 
GeneralRe: Pressing key stuff problems... Pin
Paul M Watt27-Mar-02 4:09
mentorPaul M Watt27-Mar-02 4:09 
GeneralData Grid with ADO Pin
Forlegend26-Mar-02 22:58
Forlegend26-Mar-02 22:58 
GeneralRe: Data Grid with ADO Pin
Mazdak26-Mar-02 23:09
Mazdak26-Mar-02 23:09 
GeneralRe:Re: Data Grid with ADO Pin
Forlegend26-Mar-02 23:27
Forlegend26-Mar-02 23:27 
GeneralRe:Re: Data Grid with ADO Pin
Mazdak26-Mar-02 23:47
Mazdak26-Mar-02 23:47 
GeneralRe:Re: Data Grid with ADO Pin
Forlegend27-Mar-02 0:31
Forlegend27-Mar-02 0:31 
GeneralDialog based application Pin
XAlien26-Mar-02 22:22
XAlien26-Mar-02 22:22 
GeneralRe: Dialog based application Pin
Rickard Andersson2026-Mar-02 23:15
Rickard Andersson2026-Mar-02 23:15 
GeneralRe: Dialog based application Pin
Nish Nishant27-Mar-02 2:11
sitebuilderNish Nishant27-Mar-02 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.