In the following code I have three gets and three pushbuttons.
By default the Gets are disabled and when the "Create" button
is pressed, the gets should be enabled and the focus should be
placed on the 1st get. The "Create" and "Save" functions of my
code below is working Ok enabling and disabling the gets.
But the oGet1:SetFocus() in Create() function and oBtn1:SetFocus()
in Save() function are not working at all.
I tried with oDlg:Update() and oDlg:Refresh() also in both Create()
and Save() functions without sucess.
Can anybody look into the code and suggest me where I am going
wrong?
I am using FWH 2.8 (September Build) + xHarbour 0.99.61 (Simplex)
Thanks
- Ramesh Babu P
- Code: Select all Expand view
#include "fivewin.ch"
FUNCTION main()
LOCAL oDlg, oGet1, oGet2, oGet3, oBtn1, oBtn2, oBtn3, cGet1, cGet2, cGet3
LOCAL lCreate := .T., lSave := .F., lGo := .F.
STORE SPACE(30) TO cGet1, cGet2, cGet3
DEFINE DIALOG oDlg RESOURCE "TESTFOCUS"
REDEFINE GET oGet1 VAR cGet1 ID 101 OF oDlg UPDATE WHEN lGo
REDEFINE GET oGet2 VAR cGet2 ID 102 OF oDlg UPDATE WHEN lGo
REDEFINE GET oGet3 VAR cGet3 ID 103 OF oDlg UPDATE WHEN lGo
REDEFINE BUTTON oBtn1 ID 104 OF oDlg WHEN lCreate ;
UPDATE ACTION Create(@lCreate,@lSave,@lGo,@oGet1)
REDEFINE BUTTON oBtn2 ID 105 OF oDlg WHEN lSave ;
UPDATE ACTION Save(@lCreate,@lSave,@lGo,@oBtn1)
REDEFINE BUTTON oBtn3 ID 106 OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED ON INIT oBtn1:SetFocus()
RETURN nil
**********
FUNCTION Create(lCreate, lSave, lGo, oGet1)
lSave := .T.
lCreate := .F.
lGo := .T.
oGet1:SetFocus()
RETURN nil
**********
FUNCTION Save(lCreate, lSave, lGo, oBtn1)
lSave := .F.
lCreate := .T.
lGo := .F.
oBtn1:SetFocus()
RETURN nil
**********
/****************************************************************************
get.rc
produced by Borland Resource Workshop
*****************************************************************************/
TESTFOCUS DIALOG 6, 15, 207, 113
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing Focus"
FONT 8, "MS Sans Serif"
{
GROUPBOX "", 301, 8, 3, 192, 82, BS_GROUPBOX
LTEXT "Get - 1", -1, 20, 23, 30, 8
EDITTEXT 101, 58, 20, 132, 13
LTEXT "Get - 2", -1, 19, 44, 30, 8
EDITTEXT 102, 58, 41, 132, 13
LTEXT "Get - 3", -1, 19, 65, 30, 8
EDITTEXT 103, 58, 62, 132, 13
PUSHBUTTON "&Create", 104, 74, 92, 40, 15
PUSHBUTTON "&Save", 105, 117, 92, 40, 15
PUSHBUTTON "&Ok", 106, 160, 92, 40, 15
}