Hello All,
My following code results in the error :
DEFINE WINDOW oWnd FROM 4, 4 TO 25, 75 ;
TITLE "xCalib : Calibration Chart Generation Program" ;
MENU BuildMenu(oWnd) ;
BRUSH oBrush ;
ICON oIcon MDI
in the BuildMenu(oWnd) function
MENUITEM "Exit" ACTION oWnd:End()
What am I doing wrong ?
TIA
Milan.
How to provide Exit option in Menu class ?
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: How to provide Exit option in Menu class ?
Can I see a reduced complete sample of the problem?
EMG
EMG
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
That should work, the problem must be elsewhere in your code. What was the error message?
Unrelated, but I suggest this:
MENUITEM "E&xit Alt+F4" ACTION wndMain():End()
WndMain() returns the main window object. If you use this, then you don't have to pass around the oWnd object.
The ampersand allows the user to use the (standard) X hotkey, and Alt-F4 works to exit all Windows applications (no programming required). When you enter the above line, use the Tab key between "E&xit" and "Alt-F4."
James
Unrelated, but I suggest this:
MENUITEM "E&xit Alt+F4" ACTION wndMain():End()
WndMain() returns the main window object. If you use this, then you don't have to pass around the oWnd object.
The ampersand allows the user to use the (standard) X hotkey, and Alt-F4 works to exit all Windows applications (no programming required). When you enter the above line, use the Tab key between "E&xit" and "Alt-F4."
James
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
Dear James / Enrico,
The following code did solve my problem.
MENUITEM "E&xit Alt+F4" ACTION wndMain():End().
However my code that does not work is as follows :
TIA
Milan.
--------------------------Cut------------------------------
#include "FiveWin.ch"
function Main()
local oWnd, oBrush, oBar, oBmp, oIcon
DEFINE ICON oIcon RESOURCE 'Task'
DEFINE BRUSH oBrush STYLE BORLAND // FiveWin new predefined Brushes
DEFINE WINDOW oWnd FROM 4, 4 TO 25, 75 ;
TITLE "Test Menu Program" ;
MENU BuildMenu(oWnd) ;
BRUSH oBrush ;
ICON oIcon MDI
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
function BuildMenu (oWnd)
local oMenu
MENU oMenu
MENUITEM "&File"
MENU
MENUITEM "Exit" ACTION oWnd:End()
ENDMENU
ENDMENU
return oMenu
--------------------------Paste----------------------------
The following code did solve my problem.
MENUITEM "E&xit Alt+F4" ACTION wndMain():End().
However my code that does not work is as follows :
TIA
Milan.
--------------------------Cut------------------------------
#include "FiveWin.ch"
function Main()
local oWnd, oBrush, oBar, oBmp, oIcon
DEFINE ICON oIcon RESOURCE 'Task'
DEFINE BRUSH oBrush STYLE BORLAND // FiveWin new predefined Brushes
DEFINE WINDOW oWnd FROM 4, 4 TO 25, 75 ;
TITLE "Test Menu Program" ;
MENU BuildMenu(oWnd) ;
BRUSH oBrush ;
ICON oIcon MDI
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
function BuildMenu (oWnd)
local oMenu
MENU oMenu
MENUITEM "&File"
MENU
MENUITEM "Exit" ACTION oWnd:End()
ENDMENU
ENDMENU
return oMenu
--------------------------Paste----------------------------