Hello,can any one help me
How can i Set the tab order of control by code.iam not using Resource for designing .
Regards,
sajith
#include "FiveWin.ch"
function Main()
local oDlg, cFirst := Space( 20 ), cLast := Space( 20 )
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 1 GET cFirst
@ 2, 1 GET cLast
ACTIVATE DIALOG oDlg CENTERED
return nil
#include "FiveWin.ch"
function Main()
local oDlg, cFirst := Space( 20 ), cLast := Space( 20 )
DEFINE DIALOG oDlg TITLE "Test"
@ 2, 1 GET cLast
@ 1, 1 GET cFirst
ACTIVATE DIALOG oDlg CENTERED
return nil
#include "FiveWin.ch"
function Main()
local oDlg, cFirst := Space( 20 ), cLast := Space( 20 )
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 1 GET cLast
@ 2, 1 GET cFirst
@ 4, 1 GET cFirst
@ 5, 1 GET cFirst
@ 6, 1 GET cFirst
@ 7, 1 GET cFirst
@ 8, 1 GET cFirst
@ 3, 1 GET cFirst //3 rd control
ACTIVATE DIALOG oDlg CENTERED
return nil
in the above code i added 3rd contol in the last line i want to set the Tab position of that control to 3 . how it is possible
#include "FiveWin.ch"
function Main()
local oDlg, cFirst := Space( 20 ), cLast := Space( 20 )
Local oGet1, oGet2, oGet3, oGet4, oGet5, oGet6, oGet7, oGet8
Local cVar1, cVar2, cVar3, cVar4, cVar5, cVar6, cVar7, cVar8
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 1 GET oGet1 VAR cGet1
@ 2, 1 GET oGet2 VAR cGet2
@ 3, 1 GET oGet3 VAR cGet3 //3 rd control , moved from last line
@ 4, 1 GET oGet4 VAR cGet4
@ 5, 1 GET oGet5 VAR cGet5
@ 6, 1 GET oGet6 VAR cGet6
@ 7, 1 GET oGet7 VAR cGet7
@ 8, 1 GET oGet8 VAR cGet8
ACTIVATE DIALOG oDlg CENTERED
return nil
@ 6, 1 GET oGet6 VAR cGet6
@ 1, 1 GET oGet1 VAR cGet1
@ 2, 1 GET oGet2 VAR cGet2
TAB order will work as per the order in which the control is defined/created in your PRG. While coding you have to decide and then write the code accordingly.
it will be very difficult and time consuming if we need to alter the structure after all coding is finished
@ 2, 1 GET oGet2 VAR cGet2
@ 6, 1 GET oGet6 VAR cGet6
@ 1, 1 GET oGet1 VAR cGet1
It is just a matter of moving the Get declaration statement in the prg 1 or 2 line above or below. I don't think it is that difficult.
//------------------------------------------------------------------------------
FUNCTION ClearTextEmpPaySlipData(oDlg) //For Clearing All the Controls In the Dialog
//------------------------------------------------------------------------------
LOCAL oTxtTotalSalary,oTxtPfAmt,oTxtTaxAmt,oTxtLOPAmt,;
oTxtInsAmt,oTxtOtherDeduction, oTxtTAAmt,;
oTxtOtherAdditions,oTxtName ,oTxtBranch,;
oTxtDepartment,oTxtBasicSalary,;
oTxtDAAmt,oTxtHRAAmt,;
oCboMonth ,oTxtSalaryAdvance,oTxtMobRecov,;
oTxtPFArrers,oTxtIncentives,oTxtNoOfLeaves ,;
oTxtMobBill, oTxtPayDate,oBtnsave;
oTxtName :=oDlg:aControls[23]
oTxtBranch:=oDlg:aControls[24]
oTxtDepartment:=oDlg:aControls[25]
oCboMonth:=oDlg:aControls[26]
oTxtPayDate:=oDlg:aControls[27]
oTxtBasicSalary:=oDlg:aControls[28]
oTxtTotalSalary:=oDlg:aControls[44]
oTxtPfAmt:=oDlg:aControls[29]
oTxtTaxAmt:=oDlg:aControls[30]
oTxtNoOfLeaves:=oDlg:aControls[31]
oTxtLOPAmt:=oDlg:aControls[32]
oTxtInsAmt:=oDlg:aControls[33]
oTxtOtherDeduction:=oDlg:aControls[38]
oTxtDAAmt:=oDlg:aControls[39]
oTxtHRAAmt:=oDlg:aControls[40]
oTxtTAAmt:=oDlg:aControls[41]
oTxtOtherAdditions:=oDlg:aControls[43]
oTxtSalaryAdvance:=oDlg:aControls[34]
oTxtMobRecov:=oDlg:aControls[37]
oTxtPFArrers:=oDlg:aControls[35]
oTxtIncentives:=oDlg:aControls[42]
oTxtMobBill :=oDlg:aControls[36]
oBtnsave:=oDlg:aControls[45]
oTxtName:Varput(padr("",40))
oTxtBranch:Varput(padr("",40))
oTxtDepartment:Varput(padr("",40))
oTxtBasicSalary:Varput(Int(0))
oTxtTotalSalary:Varput(Int(0))
oTxtPfAmt:Varput(Int(0))
oTxtTaxAmt:Varput(Int(0))
oTxtLOPAmt:Varput(Int(0))
oTxtInsAmt:Varput(Int(0))
oTxtSalaryAdvance:Varput(Int(0))
oTxtOtherDeduction:Varput(Int(0))
oTxtDAAmt:Varput(Int(0))
oTxtHRAAmt:Varput(Int(0))
oTxtTAAmt:Varput(Int(0))
oTxtOtherAdditions:Varput(Int(0))
oTxtTotalSalary:Varput(Int(0))
oTxtMobRecov:Varput(Int(0))
oTxtPFArrers:Varput(Int(0))
oTxtIncentives:Varput(Int(0))
oTxtNoOfLeaves:Varput(Int(0))
oTxtMobBill:Varput(Int(0))
oCboMonth:Varput(Str(0))
oTxtPayDate:Varput(CToD(""))
oBtnsave:SetFile( "Icons\Save.bmp",)
oDlg:update()
RETURN Nil
Since you have hard coded the oDlg:aControls[nNo] it may be confusing to you to change the order. If I were to write the code, I would not have used that technique and would have opted some other way.
oTxtName :=oDlg:aControls[23]//My coding style
Local aMyControls:={nil,nil,nil,nil,nil,nil,nil}
...
...
@02.3,10 getaMyControls[1] VAR cVar1
@03.4,10 get aMyControls[2] VAR cVar2
@04.5,10 get aMyControls[3] VAR cVar3
@05.6,10 get aMyControls[4] VAR cVar4
@06.7,10 get aMyControls[5] VAR cVar5
@07.8,10 get aMyControls[6] VAR cVar6
@08.9,10 get aMyControls[7] VAR cVar7
DEFINE BUTTON aMyControl[9] .....
.....
ClearTextEmpPaySlipData(oDlg,aMyControl)
//------------------------------------------------------------------------------
FUNCTION ClearTextEmpPaySlipData(oDlg,aMyControl) //For Clearing All the Controls In the Dialog
//------------------------------------------------------------------------------
LOCAL oTxtTotalSalary,oTxtPfAmt,oTxtTaxAmt,oTxtLOPAmt,;
oTxtInsAmt,oTxtOtherDeduction, oTxtTAAmt,;
oTxtOtherAdditions,oTxtName ,oTxtBranch,;
oTxtDepartment,oTxtBasicSalary,;
oTxtDAAmt,oTxtHRAAmt,;
oCboMonth ,oTxtSalaryAdvance,oTxtMobRecov,;
oTxtPFArrers,oTxtIncentives,oTxtNoOfLeaves ,;
oTxtMobBill, oTxtPayDate,oBtnsave;
oTxtName :=aMyControl[1]
oTxtBranch:=aMyControl[2]
oTxtDepartment:=aMyControl[3]
oCboMonth:=aMyControl[4]
oTxtPayDate:=aMyControl[5]
oTxtBasicSalary:=aMyControl[6]
oTxtTotalSalary:=aMyControl[7]
...
....
oBtnsave:=aMyControl[8]
oTxtName:Varput(padr("",40))
oTxtBranch:Varput(padr("",40))
oTxtDepartment:Varput(padr("",40))
oTxtBasicSalary:Varput(Int(0))
oTxtTotalSalary:Varput(Int(0))
oTxtPfAmt:Varput(Int(0))
oTxtTaxAmt:Varput(Int(0))
oTxtLOPAmt:Varput(Int(0))
oTxtMobBill:Varput(Int(0))
oCboMonth:Varput(Str(0))
oTxtPayDate:Varput(CToD(""))
oBtnsave:SetFile( "Icons\Save.bmp",)
oDlg:update()
RETURN Nil
oMyControl:=TPublic():New(.T.)
oMyControl:cUserName1:=Space(30) // Used to hold data while Adding New User
oMyControl:cPassword1:=Space(10) // Used to hold data while Adding New User
oMyControl:nStatus1 :=1 // Used to hold data while Adding New User
oMyControl:oUserName1:=NIL // Used to hold Objects while Adding New User
oMyControl:oPassword1:=NIL // Used to hold Objects while Adding New User
oMyControl:oStatus1 :=NIL // Used to hold Objects while Adding New User
@01.1,05 get oMyControl:oUserName1 VAR oMyControl:cUserName1 of ..
@02.3,05 get oMyControl:oPassword1 VAR oMyControl:cPassword1 of ...
@03.4,05 RADIO oMyControl:oStatus1 VAR oMyControl:nStatus1 of oFolder:aDialogs[1] ;
ITEMS "Enabled","Disabled" Update
.....
ClearTextEmpPaySlipData(oDlg,oMyControl)
oMyControl:=TPublic():New(.T.)
#include "FiveWin.ch"
function Main()
local oDlg, cFirst := Space( 20 ), cLast := Space( 20 )
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 1 GET cFirst
@ 2, 1 GET cLast
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oDlg:aControls[ 2 ]:SetFocus(), .F. )
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 86 guests