Print Page | Close Window

SetDropDownWidth with combo label

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2766
Printed Date: 08 November 2025 at 7:15pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SetDropDownWidth with combo label
Posted By: Louis
Subject: SetDropDownWidth with combo label
Date Posted: 22 August 2005 at 8:28pm

Created a combo box with xtpComboLabel style. By default, the drop down width of combo is the width of combo + width of label which makes drop down appear below label. I htink it should be width of combo only, makes visual funny. Also, if I adjust the width of drop down to be smaller to be same as combo, the left edge of drop down is always at left which makes it not align with combo.

I think default behaviour should be drop down width is equal to width of combo only, and drop down left edge should always be align with left edge of combo.

Or is there a way to adjust this already ?




Replies:
Posted By: Louis
Date Posted: 22 August 2005 at 8:33pm
For an example of what it looks like look at sample CustomThemes. Open Find combo at bottom.


Posted By: Oleg
Date Posted: 22 August 2005 at 11:55pm

It is designed behaviour and works like in Office products.

For 9.80 we will add xtpFlagLeftPopup flag support for CXTPControlComboBox.

 

you can patch your sources now to allow it:

in void CXTPPopupBar::UpdateFlags()

replace

m_popupFlags = xtpPopupDown;

to

m_popupFlags |= xtpPopupDown;

 

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Louis
Date Posted: 23 August 2005 at 10:59am

thanks Oleg. I tried the patch but it does not seem to work.

To be sure here is what I did:

In XTPPopupBar.cpp, in function UpdateFlags()

if (m_pControlPopup->GetType() == xtpControlComboBox && pParent->GetType() != xtpBarTypePopup)
{

    //m_popupFlags = xtpPopupDown;

    //LDaoust: 2005-08-23
   
m_popupFlags |= xtpPopupDown;
}

I recompiled, put a breakpoint, breakpoint was hit, so code is executed, but I dont see any change. Drop down is still left align with label.

 



Posted By: Oleg
Date Posted: 23 August 2005 at 11:21am

because you must add xtpFlagLeftPopup  flag.

 

in OnCreateControl function also add

pControlCombo->SetFlags(xtpFlagLeftPopup);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 23 August 2005 at 11:23am

and change width

pCombo->SetDropDownWidth(100);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Louis
Date Posted: 23 August 2005 at 11:43am

Ok, now it is working.

I noticed there is a function: CXTPControlComboBox::GetLabelWidth()

Is there a way I could use this function to find the proper width of drop down to use ? I tried using it in OnCreateControl but the label width is 0 at that time.

I tried this:

case ID_COMBO_DAYS:
{
    m_pComboDays =
new CXTPControlComboBox();

    if( m_pComboDays )
    {
        m_pComboDays->SetFlags(xtpFlagLeftPopup);
        lpCreateControl->pControl = m_pComboDays;
        m_pComboDays->SetStyle(xtpComboLabel);

        int nMyWidth = 70;
        m_pComboDays->SetWidth( nMyWidth );
       
int nLabelWidth = m_pComboDays->GetLabelWidth();
        //Unfortunatly label width = 0
       
m_pComboDays->SetDropDownWidth( nMyWidth-nLabelWidth );
    }
}



Posted By: Louis
Date Posted: 24 August 2005 at 8:30am

ok, if it helps any other, I set the proper width in OnInitCommandsPopup which is triggered by the ON_XTP_INITCOMMANDSPOPUP() message map macro.

Can't wait for 9.8 to get this support and other goodies

thanks Oleg for all your help, you are the master.

Louis.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net