I don't understand why code " form1.setfocus" not work in PROC1 but works in PROC3.
Apichit
Code: Select all
#include <hmg.ch>
Function Main
DEFINE WINDOW WinMain ;
AT 0,0 ;
WIDTH 640 ;
HEIGHT 460 ;
TITLE "Move child window over another chile window" ;
ICON "InvoiceIcon" ;
MAIN ;
backcolor {0, 128, 192};
@ 176,320 BUTTON cmdForm1 ;
CAPTION '&Form1' ;
ACTION proc1() ;
BOLD
@ 204,320 BUTTON cmdForm2 ;
CAPTION 'Form2' ;
ACTION proc2() ;
BOLD
@ 232,320 BUTTON cmdForm1Top ;
CAPTION 'Form1 on Top' ;
ACTION proc3() ;
BOLD
END WINDOW
*Maximize window winMain
Center window winMain
ACTIVATE WINDOW WinMain
Return
static proc proc1
if isWindowDefined(form1)
form1.setfocus // This line give an error at complie time
return nil
endif
define window form1 ;
at 114,218 ;
width 334 ;
height 276 ;
child ;
title 'form1'
end window
form1.activate
RETURN
static proc proc2
define window form2 ;
at 214,188 ;
width 334 ;
height 276 ;
child ;
title 'form2'
end window
form2.activate
RETURN
static proc proc3
form1.setfocus // This line works well at compile and rum time
RETURN