In an Xbrowse I usually do the following for a logical field
- Code: Select all Expand view
WITH OBJECT :aCols[09]
:SetCheck( { "SI16","NO16" } )
END
but what should I do for a decimal field ?
Regards
WITH OBJECT :aCols[09]
:SetCheck( { "SI16","NO16" } )
END
In an Xbrowse I usually do the following for a logical field
WITH OBJECT :aCols[09]
:SetCheck( { "SI16","NO16" } )
END
but what should I do for a decimal field ?
// numeric
:aCols[ 4 ]:nEditType := EDIT_BUTTON
:aCols[ 4 ]:addbmpfile( c_path1 + "Checkon.bmp" ) // from Disk
:aCols[ 4 ]:addbmpfile( c_path1 + "Checkoff.bmp" ) // from Disk
:aCols[ 4 ]:bBmpData := {|| IIF( oCust:Age < 30, 1, 2 ) }
:aCols[ 4 ]:bAlphaLevel := { || IF( ( oBrw:cAlias )->( Deleted() ) , 60, 255 ) }
:aCols[ 4 ]:bEditBlock := { | nRow, nCol, oCol, nKey | ;
Retvalue := MYCELLDLG( oBrw, nRow, nCol, oCol, nKey, ;
aItems3, aImages, 0, oListFont, 16769217, oFont, oCust ), ;
IIF( Retvalue <> NIL, ( oCust:Age := VAL(Retvalue), oBrw:RefreshCurrent(), ;
oBrw:SelectCol(5) ), NIL ) } // next column
:aCols[ 4 ]:bClrStd := { || { If( oCust:Age > 30, CLR_HRED, CLR_BLACK ), CLR_WHITE } }
// --------------
FUNCTION MYCELLDLG( oBrw, nRow, nCol, oCol, nKey, aItems, aImages, nSpace, oListFont, nColor, oFont, oCust )
LOCAL oDlg, oLbx, oBtn[3] , nDlgHeight := 100, nRowHeight := 20, nBrwHeight := 100
LOCAL cItem := oCol:Value, cRet, nBtnTop := 100, oCal, dDate := Date(), oRadio, nRadio := 1
LOCAL nWidth := oCol:nWidth - 20, aRadItems[5], oSay
LOCAL nBtnleft := (( nWidth - 60 ) / 2 ) + 5
cItem := ALLTRIM(STR(oCol:Value) )
DEFINE DIALOG oDlg SIZE nWidth +23, nDlgHeight PIXEL TRUEPIXEL FONT oListFont ;
STYLE WS_POPUP | WS_THICKFRAME
IF nSpace = 0
@ 5, 5 LISTBOX oLbx VAR cItem ITEMS aItems ;
SIZE nWidth, nBrwHeight PIXEL OF oDlg
ELSE
@ 5, 5 LISTBOX oLbx VAR cItem ITEMS aItems BITMAPS aImages ;
SIZE nWidth, nBrwHeight PIXEL OF oDlg
ENDIF
oLbx:SetColor( 0, nColor )
oLbx:bLDblClick := { || cRet := oLbx:GetSelText(), oDlg:End() }
oLbx:bKeyDown := {|nKey| iif(nKey = 13, ( cRet := oLbx:GetSelText(), oDlg:End() ), ), ; // return
iif(nKey = 27, oDlg:End(), ) } // excape
@ nBtnTop, nBtnleft BTNBMP oBtn[1] OF oDlg ;
SIZE 60, 28 PIXEL 2007 ; // B / H
PROMPT "&Cancel" ;
ACTION oDlg:End() ;
FONT oListFont CENTER BORDER
ACTIVATE DIALOG oDlg ; // adjusted to listbox
ON INIT ( DRAW_BOX(oDlg, oBtn, oLbx, cType, aItems, nSpace, nWidth), ;
oCol:AnchorToCell( oDlg ), oDlg:SetColor( 0, nColor ) ) // connect to cell
RETURN cRet
// ----------------
STATIC FUNCTION DRAW_BOX(oDlg, oBtn, oLbx, aItems, nImgHeight, nWidth)
LOCAL nLbHeight, nItemHeight
nItemHeight := oLbx:SendMsg( LB_GETITEMHEIGHT, 0, 0 )
nItems := LEN(aItems)
IF nImgHeight = 0
nLbHeight := nItemHeight * nItems +15 // browser-hight no images
ELSE
nLbHeight := nImgHeight * nItems +15 // browser-hight with images
ENDIF
oLbx:nHeight := nLbHeight
oLbx:Refresh()
oDlg:Move( 0, 0, nWidth +23, nLbHeight + 50, .t. ) // adjust the dialog to browser
oBtn[1]:nTop := oDlg:nHeight -50
oBtn[1]:Refresh() // button-position
RETURN nLbHeight
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 18 guests