Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - SetDropDownWidth with combo label
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SetDropDownWidth with combo label

 Post Reply Post Reply
Author
Message
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Topic: SetDropDownWidth with combo label
    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 ?

Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Posted: 22 August 2005 at 8:33pm
For an example of what it looks like look at sample CustomThemes. Open Find combo at bottom.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2005 at 11:23am

and change width

pCombo->SetDropDownWidth(100);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post 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 );
    }
}

Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.