Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Shortcut Bar
  New Posts New Posts RSS Feed - How do I create shortcut bar on dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How do I create shortcut bar on dialog

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


Joined: 27 June 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote sher Quote  Post ReplyReply Direct Link To This Post Topic: How do I create shortcut bar on dialog
    Posted: 27 June 2007 at 7:57am
Hi,
 
How can I create a shortcut bar (similar to the one shown in the image) on
 
a dialog. Also I would want the shortcut bar to behave in the same way as
 
shown.
 
Please help.
 
Thanks.
 
shown when resizing of the dialog is done.
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 2:54pm
Hello,
 
You can crate in like our sample using Create method, or if you want to add it to resources - add custom control with window class = "XTPShortcutBar".
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sher View Drop Down
Newbie
Newbie


Joined: 27 June 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote sher Quote  Post ReplyReply Direct Link To This Post Posted: 27 June 2007 at 11:33pm
Hi Oleg,
 
I had tried the provided sample code by simply creating a dialog and
placing the following code snippet (taken from XTPro 'ShortcutBar'
workspace) in the 'OnInitDialog'
 
Please check the code and the corresponding comments (or questions)
 
 CXTPShortcutBar  cxtpsbShortcutBar;
 cxtpsbShortcutBar.Create(WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(50, 50, 50, 50),  this, 32935); 
/*What would be the likely values for the 2nd, 3rd and 4th arguments in the above statement for a simple newly created dialog*/
 cxtpsbShortcutBar.SetOwner(this);
 cxtpsbShortcutBar.GetToolTipContext()->SetStyle(xtpToolTipOffice);
 XTPImageManager()->SetIcons(IDB_SHORTCUTS_SMALL,
  shortcuts, sizeof(shortcuts)/sizeof(UINT), CSize(16, 16));
 CXTPShortcutBarItem* pItemMail = cxtpsbShortcutBar.AddItem ID_SHORTCUT_MAIL);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_CALENDAR);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_CONTACTS);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_TASKS);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_NOTES);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_FOLDERS);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_SHORTCUTS);
 cxtpsbShortcutBar.AddItem(ID_SHORTCUT_JOURNAL);
 cxtpsbShortcutBar.SelectItem(pItemMail);
 cxtpsbShortcutBar.LoadState(_T("ShortcutBar"));
 
I've also included the following code (as global array) in the same .cpp file
where the above code is placed :
 
static UINT shortcuts[] =
{
 ID_SHORTCUT_MAIL,
 ID_SHORTCUT_CALENDAR,
 ID_SHORTCUT_CONTACTS,
 ID_SHORTCUT_TASKS,
 ID_SHORTCUT_NOTES,
 ID_SHORTCUT_FOLDERS,
 ID_SHORTCUT_SHORTCUTS,
 ID_SHORTCUT_JOURNAL
};
 
I have imported 'IDB_SHORTCUTS_SMALL' bitmap and placed it under
'Bitmap' in the Resource view and have created the above identifiers in
the string table as in the sample workspace.
 
Is there anything else which I've missed out ?
 
I'm looking for an output where my dialog would launch with the said
bitmap in a specified position (say at the middle) and when resizing of the
dialog is done it would behave in the same way as shown in the image.
 
Thanx for your effort.
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: 28 June 2007 at 1:03am
Hello,
 
yes, code looks right - only move "CXTPShortcutBar  cxtpsbShortcutBar" to members of dialog and make some visible rect in second parameter - CRect(0, 0, 50, 100)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sher View Drop Down
Newbie
Newbie


Joined: 27 June 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote sher Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2007 at 1:43am
Thanx Oleg. The shortcut bar is displayed on the dialog now.
 
But when I resize the dialog, the behaviour of the shortcut bar is not the same as shown in the image (ie the icons move downwards).
 
Where and how is this handled in the Sample workspace and could I handle it for a dialog using the 'right' position of the dialog (as in a CRect's 3rd argument)
 
Basically I'm looking for the icons to be displayed below when the right edge of the dialog is dragged over the shortcut bar, leading to hiding the icons in the bar.
 
Thanx.
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:11am
Hello,
 
Handle WM_SIZE message and move Shortcutbar to position you need.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
sher View Drop Down
Newbie
Newbie


Joined: 27 June 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote sher Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2007 at 1:23am
Hi Oleg,
 
How can I do this for a dynamically created control ?
 
And, How can I move the icons on the control bar below on resizing of the
 
dialog?
 
Please explain.
 
Thanx
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.158 seconds.