Help for a XBrowse (SOLVED THANKS UKOENIG)

Help for a XBrowse (SOLVED THANKS UKOENIG)

Postby Armando » Sat Sep 14, 2019 4:47 pm

Hello:

In an Xbrowse I usually do the following for a logical field
Code: Select all  Expand view  RUN

                WITH OBJECT :aCols[09]
                    :SetCheck( { "SI16","NO16" } )
                END
 


but what should I do for a decimal field ?

Regards
Last edited by Armando on Mon Sep 16, 2019 2:19 pm, edited 1 time in total.
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Help for a XBrowse

Postby ukoenig » Sun Sep 15, 2019 8:59 am

Armando,

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 ?


I don't know exactly what You need
just a sample ( any fieldtype )

// 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 ) }


Image

Code: Select all  Expand view  RUN

// 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
 
Last edited by ukoenig on Sun Sep 15, 2019 5:39 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Help for a XBrowse

Postby Armando » Sun Sep 15, 2019 4:35 pm

Ukoenig:

Thanks for you answer but is not exactly what i need, what I need in a TXBrowse to show
a checkbox but for a numeric field, If it is cero value then show a non cheched
checkbox bitmap, if it is greater than cero value then show a checked checkbox
bitmap.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Help for a XBrowse

Postby ukoenig » Sun Sep 15, 2019 5:01 pm

Armando,

it is the logic I'm using for the field AGE
< 30 = .T. and >= 30 = .F.
instead of a the checkbox-symbol I use bitmaps YES and NO
These bitmaps can be replaced with checkbox-bitmaps if needed.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Help for a XBrowse

Postby Armando » Sun Sep 15, 2019 5:10 pm

ukoening:

Yes you are right, I'll try it.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Help for a XBrowse

Postby ukoenig » Sun Sep 15, 2019 5:39 pm

Amando,

the result of the the bitmap-changes

Image

The 2 needed bitmaps with the same size like the checkbox

right mouseclick for download

Image

Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Help for a XBrowse

Postby Armando » Mon Sep 16, 2019 2:18 pm

ukoenig:

Solved, thanks for your clues.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 55 guests