Print Page | Close Window

How to replace the default bitmaps?

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=15066
Printed Date: 31 October 2024 at 10:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to replace the default bitmaps?
Posted By: robin_l
Subject: How to replace the default bitmaps?
Date Posted: 28 August 2009 at 7:42am
At lot of the built-in bitmaps in the Toolkit look rather dated in that they are 8-bit. For example, the edit control menu is as below:
 
 
(Also, why does this menu always appear with the underscore characters visible?????)
 
Is there an easy way of replacing this and similar bitmaps (this one derives from tbar_hex.bmp) WITHOUT modifying the CodeJock source? I don't want to do that (even though it is easy to do) as that would mean having to remember to modify the resource files after every update.
 
I've tried just loading a bitmap with the same resource id into my own resource file, but that clearly isn't sufficient and does not do anything.


-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)



Replies:
Posted By: Oleg
Date Posted: 31 August 2009 at 7:20am
Hi,
 
Try add modified bitmap to your resources and add
XTPResourceManager()->SetResourceHandle(AfxGetInstanceHandle());


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


Posted By: robin_l
Date Posted: 04 September 2009 at 7:35pm
This doesn't seem to change things for me . I'm statically linking the library, so I guess everything is in the same resource file anyway.

-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)


Posted By: Oleg
Date Posted: 07 September 2009 at 6:35am
Hi,
 
With statically linked, afraid only replacing bitmap in our sources can help.


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


Posted By: sharky
Date Posted: 15 September 2009 at 4:04pm

May be simple?

UINT uiMenuCopyPaste[] = {ID_EDIT_CUT,ID_EDIT_COPY,ID_EDIT_PASTE,ID_EDIT_UNDO,ID_EDIT_REDO,ID_EDIT_CLEAR, ID_EDIT_PASTE_SPECIAL};

GetCommandBars()->GetImageManager()->SetIcons(IDB_TOOLBAR_EDIT, uiMenuCopyPaste, _countof(uiMenuCopyPaste), CSize(16, 16));

Where IDB_TOOLBAR_EDIT resource bitmap with new icons:
As result:
 
 


Posted By: robin_l
Date Posted: 19 September 2009 at 2:42am
Unfortunately not. The GetCommandBars()->GetImageManager()->SetIcons(...) command does set the icons for whenever you use a menu that you have created yourself and I already do this. However, the in-built edit controls don't use these. I already do this for menus I create, for example, the menu below within a grid control (home grown) is "mine" and uses redefined ID_EDIT_CUT etc:
 
However, my application happens to allow editing of the text within the grid shown above using a standard edit box, which produces the following:
 
This, and all edit controls within dialog boxes, uses the hard-wired CodeJock resources. It also, for reasons I don't understand, ALWAYS shows the keyboard accelerators (the underlines on the menu text) even though the ALT key is not depressed.


-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)


Posted By: robin_l
Date Posted: 19 September 2009 at 5:19pm
OK! I've worked out a general and simple way to selectively replace any of the CodeJock resources in a statically linked project, without having to edit any of the CodeJock source!!!!
 
The trick is to point the resource compiler to a new directory where you place any edited resource files, replicating the CodeJock directory structure.
 
First, edit the properties for your project's resource file (.RC) and add a new directory to the include directory path--here you will place any edited bitmaps:
 
 
In this example I've added a subdirectory to my RES directory, which seems a suitable place for this.
 
Within this subdirectory, recreate any relevant directory stucture found in the CodeJock source directory--you only need to do this for any individual files that you wish to replace. For example, the bitmap used for the edit menu is found at Controls\res\tbar_hex.bmp. Therefore to replace just this file, I create a $(ProjectDir)RES\CodeJockReplace\Controls\res\tbar_hex.bmp file that uses the images I require. The magic of setting the include directory for the .RC file is that during compilation it will search for resource elements in that directory first and will only go to the default directories if nothing is found.
 
After putting an edited tbar_hex.bmp file there, the result in my application is as below:
 
 
Result! All edit controls within the application are now updated.
 
Repeat as required for any bitmap. The beauty is that there is no need to edit the CodeJock source, which means that nothing should break when new versions of the library are released.


-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)


Posted By: Oleg
Date Posted: 21 September 2009 at 2:37am
Thanks for sharing this idea :)

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


Posted By: robin_l
Date Posted: 21 September 2009 at 2:46am
No problem!
 
But could you take a look to see why the edit control context menu ALWAYS shows the keyboard accelerators (the underlines on the menu text) even when the ALT key is not depressed. I looked through the code but could not find any reason that this should be happening.....


-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)


Posted By: znakeeye
Date Posted: 21 September 2009 at 3:16am
Which Grid control are you using? :o

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: robin_l
Date Posted: 21 September 2009 at 4:28pm
Originally posted by znakeeye znakeeye wrote:

Which Grid control are you using? :o
Home-grown and idiosyncratic

-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)


Posted By: Oleg
Date Posted: 22 September 2009 at 3:48am
Hi,
 
Yes, there is such thing :( Such context menu doesn't linked to any CXTPCommandBars so can't use its keyboardCuesShow option.
 
If you use CXTPEdit - you can create own class, copy OnContextMenu previous code, but instead XTFuncContextMenu call some pCommandBars->TrackPopupMenu.


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


Posted By: robin_l
Date Posted: 22 September 2009 at 4:24pm
Yes, but then you would have to remember replace every edit control with some sort of C_My_XTPEdit, which is not really the point, and the keyboard cues are wrong if you don't...
 
 
I see that the CTTPEdit context menu is created with a NULL CXTPCommandBars* within XTFuncContextMenu() [Controls\XTFunctions.cpp].
 
If you rewrite this as below then the edit control context menu not only works properly, it allows the status bar text to be shown correctly when the menu is displayed (and you even get tool tips if enabled).
 

CXTPMDIFrameWnd* pMainWnd = DYNAMIC_DOWNCAST(CXTPMDIFrameWnd, AfxGetMainWnd());
CXTPFrameWnd* pFrameWnd = DYNAMIC_DOWNCAST(CXTPFrameWnd, AfxGetMainWnd());
CXTPCommandBars* pCommandBars = NULL;
if (pMainWnd)
{
    pCommandBars = pMainWnd->GetCommandBars();
}
else if (pFrameWnd)
{
    pCommandBars = pFrameWnd->GetCommandBars();
}
  CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(pCommandBars);
 
XTFunctions.cpp also needs to
#include <CommandBars\XTPFrameWnd.h>
for this to compile
 
 


-------------
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit)
Language: Visual Studio 2010 (C++)



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