is there a sample how use a xbrowse and modify the record as editcell of wbrowse ?
tx
EditCell
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: EditCell
After creating XBrowse, set
for any column you want the user to edit. When the user presses Enter key or Double clicks the cell, the user enters editmode of the cell contents.
To set all columns editable
Code: Select all | Expand
oCol:nEditType := EDIT_GET
for any column you want the user to edit. When the user presses Enter key or Double clicks the cell, the user enters editmode of the cell contents.
To set all columns editable
Code: Select all | Expand
oBrw:nEditTypes := EDIT_GET
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: EditCell
Small sample
Code: Select all | Expand
#include "FiveWin.Ch"
#include "xbrowse.ch"
#include "hbcompat.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oWnd, oBrw
USE CUSTOMER
DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUSTOMER" AUTOCOLS ;
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:CreateFromCode()
END
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 465
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Contact:
Re: EditCell
oCol := obrow1:AddCol()
oCol:bStrData := {||odb1:centerid}
oCol:cHeader := "编码"
oCol:bEditValue := {||odb1:centerid}
oCol:nEditType := {||if(ledit,1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb1:centerid,;
(if(odb1:EOF(),;
(odb1:centerid:=v,odb1:enddate:=CTOD("2999.12.31"),odb1:APPEND(),obrow1:refresh(),if(!oserver:lerror,obrow1:SEEK(v),msgstop("编码重复!","停止"))),;
(centerid1:=odb1:centerid,odb1:centerid:=v,odb1:save(),obrow1:refresh(),if(oserver:lerror,(msgstop("编码重复或者单据已经使用而不能更改!","停止"),obrow1:SEEK(centerid1)),obrow1:SEEK(v)) );
);
), ;
) }
oCol:ctooltip:="编码不能重复,(工作中心就是小组,单条生产线的'工序')"
ocol:nwidth:=60
oCol := obrow1:AddCol()
oCol:bStrData := {||odb1:center}
oCol:cHeader := "工作中心名称"
oCol:bEditValue := {||odb1:center}
oCol:nEditType := {||if(ledit.and.!odb1:EOF(),1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb1:center,(odb1:center:=v,odb1:save()) , ) }
ocol:nwidth:=100
// I modified oCol:nEditType ,so act as blwhen .
Shuming Wang
oCol:bStrData := {||odb1:centerid}
oCol:cHeader := "编码"
oCol:bEditValue := {||odb1:centerid}
oCol:nEditType := {||if(ledit,1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb1:centerid,;
(if(odb1:EOF(),;
(odb1:centerid:=v,odb1:enddate:=CTOD("2999.12.31"),odb1:APPEND(),obrow1:refresh(),if(!oserver:lerror,obrow1:SEEK(v),msgstop("编码重复!","停止"))),;
(centerid1:=odb1:centerid,odb1:centerid:=v,odb1:save(),obrow1:refresh(),if(oserver:lerror,(msgstop("编码重复或者单据已经使用而不能更改!","停止"),obrow1:SEEK(centerid1)),obrow1:SEEK(v)) );
);
), ;
) }
oCol:ctooltip:="编码不能重复,(工作中心就是小组,单条生产线的'工序')"
ocol:nwidth:=60
oCol := obrow1:AddCol()
oCol:bStrData := {||odb1:center}
oCol:cHeader := "工作中心名称"
oCol:bEditValue := {||odb1:center}
oCol:nEditType := {||if(ledit.and.!odb1:EOF(),1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb1:center,(odb1:center:=v,odb1:save()) , ) }
ocol:nwidth:=100
// I modified oCol:nEditType ,so act as blwhen .
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Re: EditCell
Nages
nor run the final user can edit the record but then whe nthe user press return it return as before
aBrowse := { { { || CE->ALIMENTO }, i18n("Alimento"), 350, },;
{ { || CE->PROTEINE }, i18n("Proteine"),40, },;
{ { || CE->GLUCIDI }, i18n("Glucidi"),40, },;
{ { || CE->LIPIDI }, i18n("Lipidi"),40, },;
{ { || CE->KALORIE }, i18n("Calorie"),40, },;
{ { || Mese(val(CE->STAG1)) }, i18n("Da mese"),80, },;
{ { || Mese(val(CE->STAG2)) }, i18n("A mese"),80, }}
FOR i := 1 TO Len(aBrowse)
oCol := oApp():oGrid:AddCol()
oCol:bEditValue := aBrowse[ i, 1 ]
* oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
if !Empty(aBrowse[ i, 4 ])
oCol:cEditPicture:=aBrowse[ i, 4 ]
Endif
NEXT
WITH OBJECT oApp():oGrid
:nEditTypes := EDIT_GET
END
oApp():oGrid:SetRDD()
oApp():oGrid:CreateFromCode()
nor run the final user can edit the record but then whe nthe user press return it return as before
aBrowse := { { { || CE->ALIMENTO }, i18n("Alimento"), 350, },;
{ { || CE->PROTEINE }, i18n("Proteine"),40, },;
{ { || CE->GLUCIDI }, i18n("Glucidi"),40, },;
{ { || CE->LIPIDI }, i18n("Lipidi"),40, },;
{ { || CE->KALORIE }, i18n("Calorie"),40, },;
{ { || Mese(val(CE->STAG1)) }, i18n("Da mese"),80, },;
{ { || Mese(val(CE->STAG2)) }, i18n("A mese"),80, }}
FOR i := 1 TO Len(aBrowse)
oCol := oApp():oGrid:AddCol()
oCol:bEditValue := aBrowse[ i, 1 ]
* oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
if !Empty(aBrowse[ i, 4 ])
oCol:cEditPicture:=aBrowse[ i, 4 ]
Endif
NEXT
WITH OBJECT oApp():oGrid
:nEditTypes := EDIT_GET
END
oApp():oGrid:SetRDD()
oApp():oGrid:CreateFromCode()
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: EditCell
The way you coded, it does not work.
The way I coded it works.
Please test my code as it is.
The way I coded it works.
Please test my code as it is.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: EditCell
ok I must use only
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUSTOMER" AUTOCOLS ;
CELL LINES NOBORDER FASTEDIT
is there another method because I have another configuration please :
oApp():oGrid := TXBrowse():New( oApp():oDlg )
oApp():oGrid:nTop := 00
oApp():oGrid:nLeft := nSplit+2
oApp():oGrid:nBottom := 200
oApp():oGrid:nRight := 400
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUSTOMER" AUTOCOLS ;
CELL LINES NOBORDER FASTEDIT
is there another method because I have another configuration please :
oApp():oGrid := TXBrowse():New( oApp():oDlg )
oApp():oGrid:nTop := 00
oApp():oGrid:nLeft := nSplit+2
oApp():oGrid:nBottom := 200
oApp():oGrid:nRight := 400