XBROWSE Border on cells
XBROWSE Border on cells
Mr. Nages, can i draw a border with a specific color and width around a cell but only on cells with edit-functions (get, listbox, etc.)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: XBROWSE Border on cells
You need to use oCol:bPaintText and paint the text and border of the cells the way you want.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: XBROWSE Border on cells
Mr. Rao, can you please provide a sample, that show only the border different to the normal view (Text, Data,..) of the cell.
Re: XBROWSE Border on cells
Günther,
still a solution needed
A border around each cell or only around the column
( uses different colours as well on age ranges )

regards
Uwe
still a solution needed

You need to use oCol:bPaintText and paint the text and border of the cells the way you want.
A border around each cell or only around the column

( uses different colours as well on age ranges )

regards
Uwe

Last edited by ukoenig on Thu Apr 11, 2019 8:33 pm, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Uwe, I use a adapted version from class xbrowse. But i must every new FWH adapting new. The border with specific width and color are shown only on edit-cells and can differ any column.
Re: XBROWSE Border on cells
Günther ,
if it is the solution You are looking for -> different colors and pensize I will provide the code.
I think a border of the complete column ( edit ) is needed ?
Only functions are used, NO change of xBrowse.prg is needed :
COL_RECT( oBrw, hDC, 2, 255, 3, .F. ) // column-number, pencolor, pensize, lData
It is done using GDIPLUS, doesn't use < oCol:bPaintText >
If lData = .T. the border starts and ends with the data-area, header and footer are not included.
You can adjust the top and bottom-line ( make them not visible if needed )

regards
Uwe
The border with specific width and color are shown only on edit-cells
and can differ any column.
if it is the solution You are looking for -> different colors and pensize I will provide the code.
I think a border of the complete column ( edit ) is needed ?
Only functions are used, NO change of xBrowse.prg is needed :
COL_RECT( oBrw, hDC, 2, 255, 3, .F. ) // column-number, pencolor, pensize, lData
It is done using GDIPLUS, doesn't use < oCol:bPaintText >
If lData = .T. the border starts and ends with the data-area, header and footer are not included.
You can adjust the top and bottom-line ( make them not visible if needed )

regards
Uwe

Last edited by ukoenig on Fri Apr 12, 2019 1:35 pm, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Uwe, i will show the border only around the actual cell to edit and only if this cell has focus!
Re: XBROWSE Border on cells
Günther,
I tested painting a border on a defined cell.
The function will include 3 solutions
1. border on column with only data-area
2. border on column with header and footer
3. border on focused cell
I still need the status got- and lost-focus of the cell to draw or delete the border.
Painting and deleting cell-borders is working
.
for a selected cell something like:
:bGotfocus := {|nRow, nCol|...
:bLostfocus := {|nRow, nCol|...
or is it possible to use :
METHOD GotFocus( hCtlFocus ) INLINE ( ::oActive := Self, ::Super:GotFocus( hCtlFocus ),;
If( GetParent( hCtlFocus ) != ::hWnd, ::Super:Refresh( .f. ),) )
METHOD LostFocus( hCtlFocus ) INLINE ( ::Super:LostFocus( hCtlFocus ),;
If( GetParent( hCtlFocus ) != ::hWnd, ::Super:Refresh( .f. ), ) )

regards
Uwe
I tested painting a border on a defined cell.
The function will include 3 solutions
1. border on column with only data-area
2. border on column with header and footer
3. border on focused cell
i will show the border only around the actual cell to edit and only if this cell has focus!
I still need the status got- and lost-focus of the cell to draw or delete the border.
Painting and deleting cell-borders is working

for a selected cell something like:
:bGotfocus := {|nRow, nCol|...
:bLostfocus := {|nRow, nCol|...
or is it possible to use :
METHOD GotFocus( hCtlFocus ) INLINE ( ::oActive := Self, ::Super:GotFocus( hCtlFocus ),;
If( GetParent( hCtlFocus ) != ::hWnd, ::Super:Refresh( .f. ),) )
METHOD LostFocus( hCtlFocus ) INLINE ( ::Super:LostFocus( hCtlFocus ),;
If( GetParent( hCtlFocus ) != ::hWnd, ::Super:Refresh( .f. ), ) )

regards
Uwe

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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Finished
added to a existing sample
Autofocus on first column
Border deleted loosing the focus
You can use rounded as well or changing the bordercolor and pensize

You can download the complete source and running exe
http://www.pflegeplus.com/DOWNLOADS/Border.zip
maybe You must delete this line :
oBrw:lHoverSelect := .T. // autofocus
regards
Uwe


added to a existing sample
Autofocus on first column
Border deleted loosing the focus
You can use rounded as well or changing the bordercolor and pensize

You can download the complete source and running exe
http://www.pflegeplus.com/DOWNLOADS/Border.zip
maybe You must delete this line :
oBrw:lHoverSelect := .T. // autofocus
Code: Select all | Expand
#include "fivewin.ch"
STATIC lDel := .F., nColRow := 1
FUNCTION MAIN()
local oWnd, oBrw, oFont, oBold
USE WWONDERS NEW
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE FONT oBold NAME "VERDANA" SIZE 0,-13 BOLD
DEFINE WINDOW oWnd TITLE "Image and Text in same cell"
oWnd:SetFont( oFont )
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "WWONDERS" ;
COLUMNS "NAME","DETAILS" COLSIZES 200, 250 ;
LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 200
oBrw:bChange := { || MOVEBORDER( oBrw ) }
oBrw:lHoverSelect := .T. // autofocus
WITH OBJECT :aCols[ 1 ]
:bStrImage := { || FIELD->IMAGE }
:oDataFont := oBold
:nDataStrAlign := AL_CENTER + AL_BOTTOM
:nDataBmpAlign := AL_CENTER
:aImgRect := { nil, nil, -40, nil }
END
//
:CreateFromCode()
END
oWnd:oClient := oBrw
oWnd:nHeight := 700
oBrw:bPainted := < |hDC|
// CELL_BORDER( oBrw, hDC, nColumn, nRow, nRGBColor, nCellPen, lDel )
CELL_BORDER( oBrw, hDC, 1, nColRow, 255, 10, lDel )
RETURN NIL
>
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONT oFont, oBold
RETURN NIL
//----------------------------
FUNCTION MOVEBORDER( oBrw )
IF oBrw:nColSel = 1
lDel := .T.
oBrw:Refresh()
lDel := .F.
nColRow := oBrw:nRowSel
ELSE
lDel := .T.
ENDIF
oBrw:Refresh()
RETURN NIL
// -------------
FUNCTION CELL_BORDER( oBrw, hDC, nCol, nRow, nRGBColor, nCellPen, lDel )
LOCAL oGraphics := Graphics():New( hDC )
LOCAL nRed := nRGBRed( nRGBColor )
LOCAL nGreen := nRGBGreen( nRGBColor )
LOCAL nBlue := nRGBBlue( nRGBColor )
LOCAL oPen := Pen():New( 255, nRed, nGreen, nBlue, nCellPen )
LOCAL aRect := oBrw:aCellCoor( nRow, nCol ) // --> { nTop, nLeft, nBottom, nRight }
LOCAL nLeft := oBrw:aCols[ nCol ]:nDisplayCol - nCellPen
LOCAL nWidth := oBrw:ColAtPos( nCol ):nWidth() + nCellPen + 3
LOCAL nHeight := oBrw:nRowHeight + nCellPen + 3
IF lDel = .F.
oGraphics:DrawRect( oPen, ,nLeft, aRect[1] - nCellPen +2, nWidth, nHeight )
ELSE
oGraphics:DrawRect( oPen, ,nLeft, aRect[1] - nCellPen, 0, 0 )
ENDIF
oPen:Destroy()
oGraphics:Destroy()
RETURN NIL
regards
Uwe

Last edited by ukoenig on Tue Apr 16, 2019 3:33 pm, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
A extended test :
For the test You need the new :
oBrw:lHoverSelect := .T. // autofocus
1. using multiple columns
2. different forms and colors for each column
3. select if You want to show a border only on focused cell or all defined edit-cells on row-focus

regards
Uwe
For the test You need the new :
oBrw:lHoverSelect := .T. // autofocus
1. using multiple columns
2. different forms and colors for each column
3. select if You want to show a border only on focused cell or all defined edit-cells on row-focus

regards
Uwe

Last edited by ukoenig on Sat Apr 13, 2019 10:31 am, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Günther,
I hope it will work for You
I think I will create a little painter with a source-generator.
testing glowing borders

Another question :
did You try to compile < TGDIPLUS.cpp >
For any reason I don't get it working.
I want to test the new texture-brush - solution.
Maybe You have a link sample ?
regards
Uwe
I hope it will work for You
I think I will create a little painter with a source-generator.
testing glowing borders


Another question :
did You try to compile < TGDIPLUS.cpp >

For any reason I don't get it working.
I want to test the new texture-brush - solution.
Maybe You have a link sample ?
regards
Uwe

Last edited by ukoenig on Sun Apr 14, 2019 8:20 pm, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Uwe, maybe you have not switched the compiler to C++! Add the switch -P to your compiler. (Borland)
Re: XBROWSE Border on cells
Günther,
Yes it is missing
IF EXIST MAIN.res echo MAIN.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
Günther,
# $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
del b32.bc
.PRG.OBJ:
$(HBDIR)\bin\harbour $< /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include > clip.log
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c
.C.OBJ:
echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
$(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
del tmp
MAIN.res : MAIN.rc
$(BCDIR)\bin\brc32.exe -r MAIN.rc
Just tested and works
regards
Uwe
# maybe you have not switched the compiler to C++!
# Add the switch -P to your compiler. (Borland)
Yes it is missing

IF EXIST MAIN.res echo MAIN.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
Günther,
# $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
del b32.bc
.PRG.OBJ:
$(HBDIR)\bin\harbour $< /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include > clip.log
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c
.C.OBJ:
echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
$(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
del tmp
MAIN.res : MAIN.rc
$(BCDIR)\bin\brc32.exe -r MAIN.rc
Just tested and works


regards
Uwe

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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: XBROWSE Border on cells
Günther,
I created a new example to test any combination.
Some improvements are done to reduce the code-size
1. solid line or glow
2. position : outside cell, covering celllines or inside
3. a possible transparent level
4. corners rounded if selected
5. different pensizes

regards
Uwe
I created a new example to test any combination.
Some improvements are done to reduce the code-size
1. solid line or glow
2. position : outside cell, covering celllines or inside
3. a possible transparent level
4. corners rounded if selected
5. different pensizes

regards
Uwe

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.
i work with FW.
If you have any questions about special functions, maybe i can help.