newtofoxpro
Programmer
CREATE CURSOR myCursor (Fld1 c(40), Fld2 n(15,2))
INSERT INTO myCursor (Fld1,Fld2) VALUES ("Good",741.52)
INSERT INTO myCursor (Fld1,Fld2) VALUES ("Better",9887.52)
SELECT * FROM myCursor INTO CURSOR myCursor
oForm=CREATEOBJECT("myForm")
oForm.show()
READ EVENTS
DEFINE CLASS myForm as Form
ADD OBJECT oGrid as MyGrid
PROCEDURE destroy
CLEAR EVENTS
ENDDEFINE
DEFINE CLASS myGrid as Grid
AllowCellSelection = .T.
RecordSource = "myCursor"
ColumnCount = 1
PROCEDURE Init
SYS(2002)
WITH this.Column1
.Width=200
.RemoveObject('Text1')
.Addobject("CntFld","Cnt1")
.Sparse = .F.
ENDWITH
PROCEDURE Destroy
SYS(2002,1)
ENDDEFINE
DEFINE CLASS Cnt1 as Container
VISIBLE = .T.
BackStyle = 0
BorderWidth = 0
ADD OBJECT Text1 as TextBox WITH ;
Left = 0 ,;
Width = 150 ,;
BackStyle = 0 ,;
BorderStyle = 0 ,;
BackColor = RGB(0,100,100) ,;
CONTROLSOURCE="Fld1"
ADD OBJECT Text2 as TextBox WITH ;
Left = 151 ,;
Width = 50 ,;
BackStyle = 0 ,;
BorderStyle = 0 ,;
BackColor = RGB(0,0,100) ,;
Style = 1,;
CONTROLSOURCE="Fld2"
PROCEDURE Text1.Keypress(nKeyCode, nShiftAltCtrl)
IF INLIST(nKeyCode,5,24)
NODEFAULT
DO CASE
CASE INLIST(nKeyCode,24)
SKIP IN myCursor
IF EOF("myCursor")
GO BOTTOM
ENDIF
CASE nKeyCode=5
SKIP -1 IN myCursor
IF BOF("myCursor")
GO top
ENDIF
ENDCASE
this.Parent.Parent.parent.refresh()
ENDIF
ENDDEFINE
**************************
1. I need when I press up/down arrow Fld2 should change backcolor as Fld1 i.e. I want to show two field as one Column1.
2. AllowCellSelection = .T. I can not change this because I have to set another two fields as Column2
Thanks in advance
Best Regards.
INSERT INTO myCursor (Fld1,Fld2) VALUES ("Good",741.52)
INSERT INTO myCursor (Fld1,Fld2) VALUES ("Better",9887.52)
SELECT * FROM myCursor INTO CURSOR myCursor
oForm=CREATEOBJECT("myForm")
oForm.show()
READ EVENTS
DEFINE CLASS myForm as Form
ADD OBJECT oGrid as MyGrid
PROCEDURE destroy
CLEAR EVENTS
ENDDEFINE
DEFINE CLASS myGrid as Grid
AllowCellSelection = .T.
RecordSource = "myCursor"
ColumnCount = 1
PROCEDURE Init
SYS(2002)
WITH this.Column1
.Width=200
.RemoveObject('Text1')
.Addobject("CntFld","Cnt1")
.Sparse = .F.
ENDWITH
PROCEDURE Destroy
SYS(2002,1)
ENDDEFINE
DEFINE CLASS Cnt1 as Container
VISIBLE = .T.
BackStyle = 0
BorderWidth = 0
ADD OBJECT Text1 as TextBox WITH ;
Left = 0 ,;
Width = 150 ,;
BackStyle = 0 ,;
BorderStyle = 0 ,;
BackColor = RGB(0,100,100) ,;
CONTROLSOURCE="Fld1"
ADD OBJECT Text2 as TextBox WITH ;
Left = 151 ,;
Width = 50 ,;
BackStyle = 0 ,;
BorderStyle = 0 ,;
BackColor = RGB(0,0,100) ,;
Style = 1,;
CONTROLSOURCE="Fld2"
PROCEDURE Text1.Keypress(nKeyCode, nShiftAltCtrl)
IF INLIST(nKeyCode,5,24)
NODEFAULT
DO CASE
CASE INLIST(nKeyCode,24)
SKIP IN myCursor
IF EOF("myCursor")
GO BOTTOM
ENDIF
CASE nKeyCode=5
SKIP -1 IN myCursor
IF BOF("myCursor")
GO top
ENDIF
ENDCASE
this.Parent.Parent.parent.refresh()
ENDIF
ENDDEFINE
**************************
1. I need when I press up/down arrow Fld2 should change backcolor as Fld1 i.e. I want to show two field as one Column1.
2. AllowCellSelection = .T. I can not change this because I have to set another two fields as Column2
Thanks in advance
Best Regards.