Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Ribbon in dialog - 2 questions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Ribbon in dialog - 2 questions

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


Joined: 15 June 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote irekz Quote  Post ReplyReply Direct Link To This Post Topic: Ribbon in dialog - 2 questions
    Posted: 25 June 2007 at 4:07pm
Hi to all :)
 
I have 2 questions regarding ribbon in CXTPDialogBase<CXTResizeDialog> based dialog:
 
Q1) Ribbon in dialog and frame looks OK but dialog itself is not painted with blue background - is there a way to fix it?
 
Q2) My application presents a list of attachments in one of the tabs of ribbon. I need to modify it in run time. All the API seems to be there and works OK except content of ribbon is not redrawn (you need to change tabs to force redraw).
 
Here is my sample code:
 
void CSendEmailDlg::RefreshListOfAttachments()
{
  CXTPRibbonGroup* pGrp = m_pTabAttachments->FindGroup( ID_ATTACHED_FILES_GROUP );
  if( pGrp == NULL )
  {
    pGrp = m_pTabAttachments->AddGroup( ID_ATTACHED_FILES_GROUP );
  }
  pGrp->RemoveAll();
 for(int ix=0; ix<(int)vAttachmentList.size(); ix++)
 {
   CXTPControl* pCtrl = pGrp->Add(xtpControlButton, IDC_ATTACH_REMOVE);
          pCtrl->SetCaption( vAttachmentList[ix] );
          pCtrl->SetTag(ix);
 }
  CString strCaption;
  strCaption.Format( _T("No of attachments: %d"), vAttachmentList.size() );
  pGrp->SetCaption( strCaption );
}
 
Any tips how to fix it (I triend to play with simple Invalidate() but no luck)?
 
Thanks for your excelent support!
Kind regards,
Irek
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 26 June 2007 at 1:02am
Hello,
 
1. Did you call pRibbonBar->EnableFrameTheme() ?
 
2. Try to call pRibbonbar->OnRecalcLayout() in the end of method.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
irekz View Drop Down
Newbie
Newbie


Joined: 15 June 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote irekz Quote  Post ReplyReply Direct Link To This Post Posted: 26 June 2007 at 3:18pm
Hi Oleg :)
 
1) Calling RecalcLayout helps - thanks!
 
2)  Yes I'm calling pRibbonBar->EnableFrameTheme()
 
In attachment there is a screen shoot of my dialog and cpp file with dialog code - maybe that will help.
 
3) I noticed also one other thing: there is an empty space in the bottom of the dialog. It looks like space for status bar (I don't have one in my app).
Any way to get rid of it? (in dialog template edit control is placed to take all remaning space and it has: SetResize(IDC_BODY, SZ_TOP_LEFT, SZ_BOTTOM_RIGHT);
 
uploads/20070626_151244_test.zip
 
Thanks a lot for your great support!
Kind regards!
Irek
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 26 June 2007 at 3:31pm
Hi,
 
oh you mean dialog background ( I thought frame).... EnableFrameTheme
 change only Frame - if you need change background - catch WM_CTLCOLOR for dialog and return some brush.
 
3. try to switch order where you enable frame/set resize options.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
irekz View Drop Down
Newbie
Newbie


Joined: 15 June 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote irekz Quote  Post ReplyReply Direct Link To This Post Posted: 27 June 2007 at 2:19pm
Hi Oleg!
 
Originally posted by oleg oleg wrote:

catch WM_CTLCOLOR for dialog and return some brush.
 
Do I have to hardcode color or is there a way to return a brush that match current skin?
 
Originally posted by oleg oleg wrote:

3. try to switch order where you enable frame/set resize options.
 
Could not make it work. I attached a very simple dialog application that demonstrates this problem - can you check it and tell me what's wrong? (could be a good idea to add CDialog based ribbon to toolkit samples).
 
Thanks a lot for your time and help!
Irek
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 27 June 2007 at 3:38pm
Hi,
 
Here fixed dialog code: uploads/20070627_153820_t5.zip
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
irekz View Drop Down
Newbie
Newbie


Joined: 15 June 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote irekz Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2007 at 4:14am
Hi Oleg,
 
It's much better now but problem is not fully resolved.
 
In this dialog there is no status bar and still there is a space reserved at the bottom and I can't place any controls there. If you don't want status bar this space is wasted.
 
Is there a way to get rid of this limitation and put controls to the bottom of dialog (I would like list box to ocupy it with SetResize(IDC_LIST, SZ_TOP_LEFT, SZ_BOTTOM_RIGHT);) ?
 
Thanks for your help and sorry for all those questions
Irek
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 29 June 2007 at 1:10am
Hello,
Attach new sample, I not sure what do you see.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.156 seconds.