wy737 wrote:
> --- In [email protected], Thomas Hruska <thru...@...> wrote:
>> wy737 wrote:
>>> Hi, friend.
>>> Any one know how to create menu shortcut in vc++ ?
>>>
>>> I used accelerator like below:
>>>
>>> IDR_MAINFRAME ACCELERATORS
>>> BEGIN
>>>     "X",            ID_FILE_EXIT,           VIRTKEY, CONTROL
>>> END
>>>
>>> and add some for my menu like this:
>>> "E&eit\tCtrl + x"
>>>
>>> but doesn't work, even doesn't display underline ?
>>> How come ? some things wrong ? help please!
>> Well any number of things could be wrong.  The accelerator isn't being 
>> translated is the most likely cause.  The underline issue could be the 
>> OS configuration (i.e. there is a global option to turn on underlines in 
>> menus).  Your menu has to have the same ID as the accelerator to handle 
>> it correctly.  Ctrl+X may have other meanings and could be getting 
>> trapped by a standard UI component.
>>
>> BTW, Ctrl+X is typically "Cut" (for 'cut-and-paste' operations) and 
>> Alt+F4 or Ctrl+F4 are generally exit and close respectively.  You should 
>> stick to standard behavior.  Hijacking Ctrl+X is going to be weird for 
>> most people.
>>
>> -- 
>> Thomas Hruska
>> CubicleSoft President
>> Ph: 517-803-4197
>>
>> *NEW* MyTaskFocus 1.1
>> Get on task.  Stay on task.
>>
>> http://www.CubicleSoft.com/MyTaskFocus/
>>
> Thomas,  
> Thanks, I learn some thing today.
> 
> But I only create two menus:
> 
> IDR_MENU MENU DISCARDABLE 
> BEGIN
>     POPUP "&File"
>     BEGIN
>         MENUITEM "E&xit\tCtl+x",                ID_FILE_EXIT
>     END
>     POPUP "&Test"
>     BEGIN
>         MENUITEM "&Input",                      ID_TEST_INPUT
>     END
> END
> 
> 
> /////////////////////////////////////////////////////////////////////////////
> //
> // Accelerator
> //
> 
> IDR_ACCELERATOR ACCELERATORS DISCARDABLE 
> BEGIN
>     "I",            ID_TEST_INPUT,          VIRTKEY, CONTROL
> END
> 
> I use VC++ 6.0.
> I don't understand why doesn't work and even doesn't show underline ?
> could you help me !  

I second the upgrade to your compiler.  I haven't used VC++ 6 in ages 
and you are going to be hard-pressed to find someone too familiar with it.

IIRC, your menu ID should match the mainframe.  Accelerators might be 
the same way (i.e. everything related to the mainframe should probably 
be named IDR_MAINFRAME).  Set up a default MFC MDI project and see how 
it sets up the menu and accelerators.  But first upgrade your compiler. 
  Unfortunately, VC++ Express doesn't include MFC, which makes it a bit 
more difficult.

You should also consider not using MFC in the first place (since you are 
new to GUI stuff anyway).  wxWidgets, for instance, is a cross-platform 
GUI toolkit worth looking at.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to