XBROWSE : nEditType := 3 , placing the dialog

XBROWSE : nEditType := 3 , placing the dialog

Postby Franklin Demont » Fri Oct 05, 2012 3:34 pm

oBrw:nEditType := 3
oBrw:bEditBlock := {||SomeDialog(oBrw)}

Is it possible to place this dialog just below the cell to edit ?

I tryed without succes :

nRow := oBrw:oWnd:nTop + ( ( oBrw:nRowSel - 1 ) * oBrw:nRowHeight ) + oBrw:HeaderHeight() + 2 + oBrw:nTop

oBrw:oWnd:nTop seems to be 0

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: XBROWSE : nEditType := 3 , placing the dialog

Postby ukoenig » Fri Oct 05, 2012 7:27 pm

Franklin,

a sample :

Image

Code: Select all  Expand view

...
oCol  := oBrw:oCol( "Test2" )
oCol:nWidth  := 100
oCol:nEditType  := EDIT_BUTTON
oCol:bEditBlock  := { | r, c, o | EditTest( r, c, o ) }
....
//----------------------------------------------------------------------------//

STATIC FUNCTION EditTest( nRow, nCol, oCol )
local oDlg, oGet
local lEdited  := .f.
local cEdit  := FIELD->TEST2
local aPoint

aPoint   := ClientToScreen( oCol:oBrw:hWnd, { nRow, nCol } )
nRow    := aPoint[ 1 ]
nCol      := aPoint[ 2 ]

DEFINE DIALOG oDlg FROM nRow +2, nCol TO nRow + 90, nCol + 120 PIXEL STYLE WS_POPUP
@ 02,02 GET oGet VAR cEdit TEXT SIZE 50, 20 PIXEL OF oDlg COLOR 128

@ 28, 5 BUTTON "Ok" SIZE 20,10 PIXEL OF oDlg ;
ACTION ( lEdited := .t., oDlg:End() )
@ 28,  30 BUTTON "Cancel" SIZE 25,10 PIXEL OF oDlg ;
ACTION ( lEdited := .f., oDlg:End() )

SET_BRUSH( oDlg, 2, .T., 16443068, 128, 0.9, , 120, 90 )

ACTIVATE DIALOG oDlg

lEdited = lEdited .and. ( cEdit != FIELD->TEST2 )

RETURN IF( lEdited, cEdit, nil )

//--------- Background ------------------------

FUNCTION SET_BRUSH( oControl, nStyle, lDirect, nVColor, nBColor, nMove, ;
                                            cBrush, nWidth, nHeight )
LOCAL hDC, oBrush, oTmp
LOCAL aRect := GETCLIENTRECT( oControl )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }

IF nStyle = 1
    DEFINE BRUSH oBrush COLOR nVColor
    SET BRUSH OF oControl TO oBrush
    RELEASE BRUSH oBrush
ENDIF
IF nStyle = 2 // defined Width and Height !!!!!
    hDC = CreateCompatibleDC( oControl:GetDC() )
    hBmp = CreateCompatibleBitMap( oControl:hDC, nWidth, nHeight )
    hBmpOld = SelectObject( hDC, hBmp )
    GradientFill( hDC, 0, 0, nHeight, nWidth, aGrad, lDirect )
    DeleteObject( oControl:oBrush:hBrush )
    oBrush := TBrush():New( ,,,, hBmp )
    oBrush:Cargo  := aGrad
    SelectObject( hDC, hBmpOld )
    oControl:ReleaseDC()
    oControl:SetBrush( oBrush )
    RELEASE BRUSH oBrush
ENDIF
IF nStyle = 3
    DEFINE BRUSH oBrush RESOURCE cBrush
    SET BRUSH OF oControl TO oBrush
    RELEASE BRUSH oBrush
ENDIF

RETURN NIL
 


Best Regards
Uwe :lol:
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 18 guests