Menu toolbar isn't shown for On-Screen Keyboard

Ask your support questions in here

Moderator: Moderator Team

Post Reply
Fraizeraust
Posts: 228
Joined: Thu Jan 05, 2017 11:46 am
Location: Italy
Contact:

Menu toolbar isn't shown for On-Screen Keyboard

Post by Fraizeraust » Fri Mar 30, 2018 8:55 pm

I'm trying to implement a menu toolbar for On-Screen Keyboard application, "File" and "Help" respectively. I've built both the main function as well as defined the identifiers but for some odd reason the menu toolbar doesn't seem to appear. Not sure what is wrong, the RosBE doesn't report any compiling errors.

I'd be very happy if a developer can assist me on this, I'd like to get my code merged.

This is the main function:

Code: Select all

/***********************************************************************
 * 
 *           OSK_CommandMenus
 * 
 *  Menu buttons table for OSK
 */
LRESULT CALLBACK OSK_CommandMenus(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg)
    {
        case WM_CREATE:
        {
            HMENU hMenu, hSubMenu;
            hMenu = CreateMenu();

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, OSK_MENU_EXIT, L"E&xit");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"&File");

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, OSK_MENU_HELP, L"&Contents");
            AppendMenu(hSubMenu, MF_STRING, OSK_MENU_ABOUT, L"&About");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"&Help");

            SetMenu(hWnd, hMenu);
            break;
        }

        case WM_COMMAND:
        {
            switch ( LOWORD(wParam) )
            {
                case OSK_MENU_EXIT:
                {
                    PostMessageW(Globals.hMainWnd, WM_CLOSE, 0, 0);
                    break;
                }

                case OSK_MENU_HELP:
                {
                    MessageBox(hWnd, L"Warning", L"Help contents aren't implemented yet!", MB_OK | MB_ICONWARNING);
                    break;
                }

                case OSK_MENU_ABOUT:
                {
                    HICON hIcon;
                    WCHAR szTitle[MAX_STRING_LEN];
                    hIcon = LoadIconW( Globals.hInstance, MAKEINTRESOURCE(IDI_OSK) );
                    LoadStringW( Globals.hInstance, STRING_OSK, szTitle, ARRAYSIZE(szTitle) );
                    ShellAboutW(Globals.hMainWnd, szTitle, NULL, hIcon);
                    DeleteObject(hIcon);
                    break;
                }
            }
            break;
        }

        case WM_CLOSE:
        {
            DestroyWindow(hWnd);
            break;
        }

        case WM_DESTROY:
        {
            PostQuitMessage(0);
            break;
        }

        default:
        {
            return DefWindowProc(hWnd, msg, wParam, lParam);
            break;
        }

    }
    return 0;
}
Here are the definitions for the code:

Code: Select all

#define OSK_MENU_EXIT           103
#define OSK_MENU_HELP           104
#define OSK_MENU_ABOUT          105
#define STRING_OSK              106
#define IDR_OSKMENU             107
#define MAX_STRING_LEN          255
And here is the resource code:

Code: Select all

IDR_OSKMENU MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit", OSK_MENU_EXIT
    END

    POPUP "&Help"
    BEGIN
        MENUITEM "&Contents", OSK_MENU_HELP
        MENUITEM "&About", OSK_MENU_ABOUT
    END
END

STRINGTABLE
BEGIN
    STRING_OSK "On-Screen Keyboard"
END

hbelusca
Developer
Posts: 1124
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Menu toolbar isn't shown for On-Screen Keyboard

Post by hbelusca » Fri Mar 30, 2018 11:49 pm

Hi, I think you are redoing what Sergey Stopkin mentions in this PR : https://github.com/reactos/reactos/pull/412
See the last two comments.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], DotBot [Crawler] and 1 guest