|
From: <ss...@ma...> - 2012-08-01 02:23:26
|
Hi all!!
I have a problem about MDICHILD window and can't press key VK_ESCAPE
to exit, sample code is:
My test prg is MDI -> MDICHILD -> DIALOG mode,
I can exit DIALOG and press VK_ESCAPE, but can't exit when focus on
MDICHILD window, somebody can solution for me? thank you!!
//---------------------------------------------------------------------
#include "hbclass.ch"
#include "guilib.ch"
#include "windows.ch"
#include "nes.ch"
Func Main()
Local oWnd, oMenu, oPanel
INIT WINDOW oWnd MDI AT 0,0 SIZE 800, 600;
TITLE "Test MDI Windows";
MENU OF oWnd
MENU TITLE "[&A]Test"
MENUITEM "[&H]MDIChild + Dialog" ACTION Test8()
ENDMENU
ENDMENU
@ 0,0 PANEL oPanel SIZE oWnd:nWidth, 36 OF oWnd;
ON SIZE {|o,x,y|MoveWindow(o:handle, 0, 0, x, o:nHeight)}
@ 2, 2 OWNERBUTTON OF oPanel ON CLICK {|| msgInfo('Exit')} ;
SIZE 40, 32;
TEXT "Exit";
TOOLTIP "Exit Application..."
@ 42, 2 OWNERBUTTON OF oPanel ON CLICK {|| msgInfo('Printer Config')} ;
SIZE 40, 32;
TEXT "Print";
TOOLTIP "Printer Config..."
ACTIVATE WINDOW oWnd MAXIMIZED
Return NIL
// MDICHILD WINDOW: can't press VK_ESCAPE to exit
Function Test8(oWnd)
Local oChildWnd, oPanel, oFontBtn, oBoton1
PREPARE FONT oFontBtn NAME "MS Sans Serif" WIDTH 0 HEIGHT -12
INIT WINDOW oChildWnd MDICHILD OF oWnd TITLE "Child";
STYLE WS_CHILD+ WS_VISIBLE + WS_OVERLAPPEDWINDOW
@ 0,0 PANEL oPanel OF oChildWnd SIZE 0,44
@ 98,3 OWNERBUTTON oBoton1 OF oPanel ID 110 ON CLICK {|| test8dlg()} ;
SIZE 44,38 FLAT ;
TEXT "Test" FONT oFontBtn COORDINATES 0,20,0,0
oChildWnd:Activate()
Return Nil
// DIALOG: can press VK_ESCAPE exit
FUNC TEST8Dlg()
Local oDlg, oGet, oBtn
Local PD_NAM := Space(20),;
lOK := .F.
// DIALOG
INIT DIALOG oDlg AT 0, 0 SIZE 600, 480 CLIPPER NOEXIT; // NOEXITESC
ON INIT {|| hwg_CenterWindow( oDlg:handle ),;
SetFocus( oDlg:handle ) }
//
@ 10, 10 GET oGet VAR PD_NAM OF oDlg;
COLOR RGB(0,0,0) BACKCOLOR RGB(255,255,208)
//
@ 20, 10 BUTTONEX oBtn CAPTION '[&Y]Save' OF oDlg;
ON CLICK {|| lOK := .T., oDlg:Close() }
@ 20, 60 BUTTONEX oBtn CAPTION '[&X]Exit' OF oDlg;
ON CLICK {|| lOK := .F., oDlg:Close() }
//
ACTIVATE DIALOG oDlg
//
RETURN NIL
//---------------------------------------------------------------------
|