Hi Frank,
Thanks for your hard work!
There is a solution for extending the OpenGLSceneFrame WndProc, which is what you need for adding a set of menus, and any other windows items you require.
I have added a few lines to OpenglSceneFrame to make this possible:
sys WndProcExtra 'callback for customised windows message processing
function WndProc(sys hwnd, uMsg, wParam, lParam) as sys callback
================================================================
'
static sys hDC,hRC
'
if WndProcExtra
if call WndProcExtra(hwnd,uMsg,wParam,lParam) then exit function
end if
Then you can create a procedure in your application, to intercept, and possibly override the standard WndProc message processing
function WindowMessages(sys hwnd, uMsg, wParam, lParam) as sys, link WndProcExtra
...
function WindowMessages(sys hwnd, uMsg, wParam, lParam) as sys, link WndProcExtra
=================================================================================
'MENU ITEMS
'
%IDM_FILE_NEW 40001
%IDM_FILE_OPEN 40002
%IDM_FILE_SAVE 40003
%IDM_FILE_SAVE_AS 40004
%IDM_APP_EXIT 40005
%IDM_EDIT_UNDO 40006
%IDM_EDIT_CUT 40007
%IDM_EDIT_COPY 40008
%IDM_EDIT_PASTE 40009
%IDM_EDIT_CLEAR 40010
%IDM_APP_HELP 40011
%IDM_APP_ABOUT 40012
'
static sys hdc,hMenu,hMenuPopup
static String txt
static rect crect
static PaintStruct Paintst
sys id
'
select case uMsg
'
case WM_CREATE
'
hMenu = CreateMenu
hMenuPopup = CreateMenu
AppendMenu hMenuPopup, MF_STRING, IDM_FILE_NEW, "&New"
AppendMenu hMenuPopup, MF_STRING, IDM_FILE_OPEN, "&Open..."
AppendMenu hMenuPopup, MF_STRING, IDM_FILE_SAVE, "&Save"
AppendMenu hMenuPopup, MF_STRING, IDM_FILE_SAVE_AS, "Save &As..."
AppendMenu hMenuPopup, MF_SEPARATOR, 0, null
AppendMenu hMenuPopup, MF_STRING, IDM_APP_EXIT, "E&xit"
AppendMenu hMenu, MF_POPUP, hMenuPopup, "&File"
hMenuPopup = CreateMenu
AppendMenu hMenuPopup, MF_STRING, IDM_EDIT_UNDO, "&Undo"
AppendMenu hMenuPopup, MF_SEPARATOR, 0, null
AppendMenu hMenuPopup, MF_STRING, IDM_EDIT_CUT, "Cu&t"
AppendMenu hMenuPopup, MF_STRING, IDM_EDIT_COPY, "&Copy"
AppendMenu hMenuPopup, MF_STRING, IDM_EDIT_PASTE, "&Paste"
AppendMenu hMenuPopup, MF_STRING, IDM_EDIT_CLEAR, "De&lete"
AppendMenu hMenu, MF_POPUP, hMenuPopup, "&Edit"
hMenuPopup = CreateMenu
AppendMenu hMenuPopup, MF_STRING, IDM_APP_HELP, "&Help"
AppendMenu hMenuPopup, MF_STRING, IDM_APP_ABOUT, "&About MenuDemo..."
AppendMenu hMenu, MF_POPUP, hMenuPopup, "&Help"
'
SetMenu hwnd, hMenu
SetWindowText hwnd,"Menu Demo"
'
sys dis=MF_DISABLED or MF_GRAYED
CheckMenuItem hMenu,IDM_FILE_NEW, MF_CHECKED
EnableMenuItem hMenu,IDM_FILE_OPEN,dis
case WM_COMMAND
hMenu = GetMenu(hwnd)
if wparam = IDM_APP_EXIT then
SendMessage hwnd, WM_CLOSE, 0, 0
return 1 'indicate this message has been intercepted / no further action
end if
'
case WM_KEYDOWN
select case wparam
keydown 'macro
'default cases
case 27 : return 1 'intercept Esc key: prevent sutdown / take no action
end select
end select
end function
App demo and new OpenglSceneFrame Attached:
.