When one form could not be SetFocused
Posted: Thu May 15, 2014 3:10 pm
I would like to tell you guys, my experience about SetFocus.
Better than words is preferable to show source codes in place of.Why ON LOSTFOCUS is not possible to return to the Third Form ? Only if focused on another form not being Third form...
Is it normal this ? I do not understand... Is somebody understanding this ?
I guess something with post events...
Better than words is preferable to show source codes in place of.
Code: Select all
#include <hmg.ch>
Function Main()
DEFINE WINDOW Form_1 AT 219 , 253 WIDTH 678 HEIGHT 426 ;
TITLE "Main Form" MAIN ON INIT Second_Form()
END WINDOW
MAXIMIZE WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Function Second_Form()
DEFINE WINDOW Form_2 AT 200 , 400 WIDTH 478 HEIGHT 426 ;
TITLE "Second Form" CHILD ON INIT Third_Form()
DEFINE BUTTON Button_1
ROW 50
COL 50
WIDTH 100
HEIGHT 28
ACTION (Return_Third(),SetProperty("Form_2","Label_1","VISIBLE",.F.))
CAPTION "Back to Third"
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
END BUTTON
DEFINE LABEL Label_1
ROW 200
COL 50
WIDTH 220
HEIGHT 48
VALUE "No focus on Third Form... :("
FONTNAME "Arial"
FONTSIZE 9
VISIBLE .F.
BACKCOLOR Nil
FONTCOLOR RED
END LABEL
END WINDOW
ACTIVATE WINDOW Form_2
Return Nil
Function Third_Form()
DEFINE WINDOW Form_3 AT 50 , 100 WIDTH 200 HEIGHT 300 ;
TITLE "Third Form" CHILD ON LOSTFOCUS Return_Third()
DEFINE LABEL Label_1
ROW 50
COL 10
WIDTH 200
HEIGHT 48
VALUE "Click on Second Form to see if LOSTFOCUS works"
FONTNAME "Arial"
FONTSIZE 9
END LABEL
END WINDOW
ACTIVATE WINDOW Form_3
Return Nil
Function Return_Third()
DoMethod("Form_3","SetFocus")
SetProperty("Form_2","Label_1","VISIBLE",.T.)
Return Nil

Is it normal this ? I do not understand... Is somebody understanding this ?
I guess something with post events...
