|
Hi, so here's my question:
Let's say I have typical menu with a File POPUP and various other MENUITEM strings specified under that, all of which are hotkeyed with ampersands. If I want the menu items to have little underlines underneath the letters which are used for the hotkeys (i.e. the way it actually looks in the VC++ resource editor), do I need to ownerdraw the menu? Or is there a simpler way to do it?
KR
|
|
|
|
|
KellyR wrote: I want the menu items to have little underlines underneath the letters which are used for the hotkeys
just put '&' before the character that you want underline..
eg :
&File
nave
|
|
|
|
|
Well as I said, I already have them hotkeyed with ampersands, but that doesn't seem to make them draw with the underline under them. The hotkeys work, but the menu items only appear with underlines under the hotkeyed letters in the VC++ resource editor, not when I run the actual program.
KR
|
|
|
|
|
The underline will appeare only if you press the ALT key. Did you noticed that?
nave
|
|
|
|
|
using the ampersand is not called "hotkey" but "mnemonic". if you want to see the underscore, use the keyboard to open the menu (using the Alt key).
hotkey is what you ave when you press something like Ctrl+C
|
|
|
|
|
KellyR wrote: If I want the menu items to have little underlines underneath the letters which are used for the hotkeys (i.e. the way it actually looks in the VC++ resource editor), do I need to ownerdraw the menu? Or is there a simpler way to do it?
Mnemonic keys appear when you press the Alt key. Windows has a option to disable this behavior. It's not your fault it's how window's behaves if that option is on.
I forgot where the option is. Just press Alt key to see the mnemonics.
|
|
|
|
|
I'm aware that alt shows the underlines, but there are many programs in which it is not necessary to press alt (VC++, MS Excel, to name two). So I guess the short answer is yes, I do need to ownerdraw them. I was hoping there was just some simple option I could set somewhere to make it look right. Oh well. Thanks.
KR
|
|
|
|
|
KellyR wrote: I'm aware that alt shows the underlines, but there are many programs in which it is not necessary to press alt (VC++, MS Excel, to name two).
MS Excel and VC++ does not have a normal menu bar they are different class of controls called MsoCommandBar.
The normal behavior of a menu mnemonic depends on a global setting. There was a checkbox somewhere inside some propery page. I don't remember where exactly it is. I remember setting this option.
|
|
|
|
|
Oh I see, so I need to use a different class. Thanks!
KR
|
|
|
|
|
KellyR wrote: Oh I see, so I need to use a different class. Thanks!
. No. This class is not shared by Microsoft. This is their private class only used for their applications.
|
|
|
|
|
HI!
The code is below.
i had tried both the way.by using LVBKIMAGE and also used ImageList_AddIcon,but not getting fruitful result. can any guide me,please?
<br />
<br />
LVBKIMAGE IBBkImg;<br />
ZeroMemory(&IBBkImg,sizeof(LVBKIMAGE));<br />
IBBkImg.ulFlags=LVBKIF_STYLE_TILE;<br />
IBBkImg.pszImage=(LPWSTR)"C:\\ok.bmp";<br />
LvItem.iItem=0;
LvItem.iSubItem=0;
<br />
LvItem.pszText=w_UploadedFile;
SendMessage(hList,LVM_INSERTITEM,0,(LPARAM)&LvItem);
Amit
|
|
|
|
|
|
i did it. i got reference from that but in WM_PAINT gives error,AND i also took reference from 2 more places then i put here.
amit
|
|
|
|
|
|
Three errors
1)
Error 2 error LNK2019: unresolved external symbol __imp__ImageList_Create@20 referenced in function "long __stdcall GlobaListProc(struct HWND__ *,unsigned int,unsigned int,long)" (?GlobaListProc@@YGJPAUHWND__@@IIJ@Z) DRMClient.obj
2)same as bove
3)Error 5 fatal error LNK1120: 2 unresolved externals D:\Projects\Debug\DRMClient.exe
|
|
|
|
|
Did you include Commctrl.lib/ Imgctl.lib
|
|
|
|
|
I have added it. Inspite of it gives the linking error is any there other matter?
Amit
|
|
|
|
|
Requires comctl32.lib library to be linked.
|
|
|
|
|
I have already used include.
#include <commctrl.h>
is it ok? if not then guide me for explicit linking with lib.
|
|
|
|
|
|
|
how can i resolve the bugs , for linking.
I need simple first, then i will try to add the file icon . but i need base first how can any images display icon/image from resource in the listview.
|
|
|
|
|
which view are you using in list view? Report, icon etc..?
nave
|
|
|
|
|
|
1.Create a image list with width and height 20, 20 or less
2.Add icons to the image list.
3. Send LVM_SETIMAGELIST to the image list with the wparam LVSIL_SMALL and LPARAM as handle of image list.
4. Then while inserting item with the LVM_INSERTITEM message, set the appropriate values in the LVITEM structure( mask and iImage )
nave
|
|
|
|