XBROWSE Border on cells

XBROWSE Border on cells

Postby byte-one » Mon Jul 16, 2018 7:40 am

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.)
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby nageswaragunupudi » Mon Jul 16, 2018 9:51 am

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
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE Border on cells

Postby byte-one » Sat Aug 11, 2018 10:14 am

Mr. Rao, can you please provide a sample, that show only the border different to the normal view (Text, Data,..) of the cell.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby ukoenig » Thu Apr 11, 2019 8:24 am

Günther,

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 )

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby byte-one » Thu Apr 11, 2019 9:15 am

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.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby ukoenig » Thu Apr 11, 2019 8:34 pm

Günther ,

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 )

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby byte-one » Fri Apr 12, 2019 9:26 am

Uwe, i will show the border only around the actual cell to edit and only if this cell has focus!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby ukoenig » Fri Apr 12, 2019 1:35 pm

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 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. ), ) )

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: XBROWSE Border on cells

Postby ukoenig » Fri Apr 12, 2019 11:42 pm

Finished :D :D

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

Image

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 view  RUN


#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 :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby ukoenig » Sat Apr 13, 2019 8:43 am

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


Image

regards
Uwe :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby byte-one » Sat Apr 13, 2019 9:49 am

Uwe, thank you!!! I will test and report.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby ukoenig » Sat Apr 13, 2019 10:33 am

Günther,

I hope it will work for You
I think I will create a little painter with a source-generator.

testing glowing borders :idea:

Image

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 :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby byte-one » Sat Apr 13, 2019 11:24 am

Uwe, maybe you have not switched the compiler to C++! Add the switch -P to your compiler. (Borland)
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE Border on cells

Postby ukoenig » Sat Apr 13, 2019 11:36 am

Günther,

# 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 :D :D

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE Border on cells

Postby ukoenig » Sun Apr 14, 2019 8:27 pm

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

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: driessen and 53 guests