Print Page | Close Window

CXTToolBarPopupWnd Icon Swap Feature

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=3698
Printed Date: 10 November 2025 at 1:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTToolBarPopupWnd Icon Swap Feature
Posted By: kanitamildasan
Subject: CXTToolBarPopupWnd Icon Swap Feature
Date Posted: 24 February 2006 at 12:38am

Hi,

CXTToolBarPopupWnd 

The popup window contains a separate toolbar that will swap out the image with the newly selected command. Works similar to MS Word's border dropdown button.

How can i implement the same swap out feature in 9.81 XT Pro ?

Thanks in advance

 



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6



Replies:
Posted By: Oleg
Date Posted: 24 February 2006 at 7:47am

Hello,

See TearOffPopups sample.



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


Posted By: kanitamildasan
Date Posted: 25 February 2006 at 12:51am

Hello,

older CXTToolBarPopupWnd provides icon swap

i want to change the icon of commandbar button(splitbuttonpopup)
with the last seletion button's(CXTPPopupToolBar) icon???

(TearOffPopups and Office11 doesn't swap icons. their implementation
is like make selection of all the combination of border style)

thanks in advance



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6


Posted By: kanitamildasan
Date Posted: 27 February 2006 at 12:11am

Hi,

ON_UPDATE_COMMAND_UI_RANGE(ID_BDR_OUTSIDE,ID_BDR_RIGHT, OnUpdateBorder)

void CMainFrame::OnUpdateBorder(CCmdUI* pCmdUI)
{
...
pControl->SetIconId(iIconID);
...
}

when i click a button in a tear-offed border toolbar
it changes(redraw) the icon in the commandbar immediately

when i click a button in the border popupbar(without tear-off it)
it won't changes the icon immediately
(it only changes next time i click the split button in the commandbar to show popupbar)



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6


Posted By: Oleg
Date Posted: 27 February 2006 at 8:22am

Here code you need:

CMainFrame::CMainFrame()
{
 m_dwBorders = 0;

 m_nBorderIcon = ID_BDR_NONE;
}

void CMainFrame::OnBorders(UINT nID)
{
 switch (nID)
 {
  case ID_BDR_TOP: SwitchBorders(borderTop); break;
  case ID_BDR_LEFT: SwitchBorders(borderLeft); break;
  case ID_BDR_RIGHT: SwitchBorders(borderRight); break;
  case ID_BDR_BOTTOM: SwitchBorders(borderBottom); break;
  case ID_BDR_NONE: m_dwBorders = 0; break;
  case ID_BDR_OUTSIDE: SwitchBorders(borderOutside); break;
  case ID_BDR_ALL: SwitchBorders(borderAll); break;
  case ID_BDR_INSIDE_VERT: SwitchBorders(borderInsideVert); break;
  case ID_BDR_INSIDE_HORZ: SwitchBorders(borderInsideHorz); break;
  case ID_BDR_INSIDE: SwitchBorders(borderInside); break;
 }

 m_nBorderIcon = nID;

}

void CMainFrame::OnUpdateBorders(CCmdUI* pCmdUI)
{
 switch (pCmdUI->m_nID)
 {
  case ID_BDR_TOP: pCmdUI->SetCheck(m_dwBorders & borderTop? TRUE: FALSE); break;
  case ID_BDR_LEFT: pCmdUI->SetCheck(m_dwBorders & borderLeft? TRUE: FALSE); break;
  case ID_BDR_RIGHT: pCmdUI->SetCheck(m_dwBorders & borderRight? TRUE: FALSE); break;
  case ID_BDR_BOTTOM: pCmdUI->SetCheck(m_dwBorders & borderBottom? TRUE: FALSE); break;
  case ID_BDR_OUTSIDE : pCmdUI->SetCheck((m_dwBorders & borderOutside) == borderOutside? TRUE: FALSE); break;
  case ID_BDR_ALL : pCmdUI->SetCheck((m_dwBorders & borderAll) == borderAll? TRUE: FALSE); break;
  case ID_BDR_INSIDE_VERT: pCmdUI->SetCheck(m_dwBorders & borderInsideVert? TRUE: FALSE); break;
  case ID_BDR_INSIDE_HORZ: pCmdUI->SetCheck(m_dwBorders & borderInsideHorz? TRUE: FALSE); break;
  case ID_BDR_INSIDE: pCmdUI->SetCheck((m_dwBorders & borderInside) == borderInside? TRUE: FALSE); break;
 }

 if (pCmdUI->m_nID == ID_BDR_NONE)
 {
  CXTPControl* pControl = CXTPControl::FromUI(pCmdUI);
  
  if (pControl && pControl->GetType() == xtpControlSplitButtonPopup)
  {
   pControl->SetIconId(m_nBorderIcon);
  }

 }
}



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


Posted By: kanitamildasan
Date Posted: 27 February 2006 at 10:31pm

thanks,

I can change the icon but there is some redraw problem (see my previous post)



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6


Posted By: Oleg
Date Posted: 28 February 2006 at 7:59am

Hello,

I tested it before send and it worked.

Can you attach project you have now?



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


Posted By: kanitamildasan
Date Posted: 28 February 2006 at 10:36pm

Hi,

Hearty  Thanks oleg, i've corrected the problem

 



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6



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