Print Page | Close Window

How do I create shortcut bar on dialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Shortcut Bar
Forum Description: Topics Related to Codejock Shortcut Bar
URL: http://forum.codejock.com/forum_posts.asp?TID=7463
Printed Date: 18 May 2024 at 4:55am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How do I create shortcut bar on dialog
Posted By: sher
Subject: How do I create shortcut bar on dialog
Date 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.



Replies:
Posted By: Oleg
Date 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


Posted By: sher
Date 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.


Posted By: Oleg
Date 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


Posted By: sher
Date 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.


Posted By: Oleg
Date 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


Posted By: sher
Date 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



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