How do I create shortcut bar on dialog |
Post Reply |
Author | |
sher
Newbie Joined: 27 June 2007 Status: Offline Points: 4 |
Post Options
Thanks(0)
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
sher
Newbie Joined: 27 June 2007 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
sher
Newbie Joined: 27 June 2007 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Handle WM_SIZE message and move Shortcutbar to position you need.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
sher
Newbie Joined: 27 June 2007 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |