How to replace the default bitmaps? |
Post Reply |
Author | |
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
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++) |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Try add modified bitmap to your resources and add
XTPResourceManager()->SetResourceHandle(AfxGetInstanceHandle());
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
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++) |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
With statically linked, afraid only replacing bitmap in our sources can help.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
sharky
Newbie Joined: 07 January 2009 Location: Czech Republic Status: Offline Points: 9 |
Post Options
Thanks(0)
|
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:
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
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++) |
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
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++) |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks for sharing this idea :)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
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++) |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Which Grid control are you using? :o
|
|
PokerMemento - http://www.pokermemento.com/
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
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).
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++) |
|
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 |