DynamicBackColor / DynamicForeColor

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

DynamicBackColor / DynamicForeColor

Post by AUGE_OHR »

hi,

there is a Demo in c:\hmg.3.4.4\SAMPLES\Miscellaneous\Colors\DEMO.PRG
it have a Array with 2 Element {cName, aRGB} and work fine.

if found out that DynamicBackColor / DynamicForeColor use a Codeblock for each Column.
but these Color in Demo never change after create so how can i change Color after create :idea:

---

DynamicBackColor / DynamicForeColor have
- This.CellRowIndex
- This.CellColIndex
- This.CellValue
but it work only when use Keyboard or click with Mouse into GRID, right :?:
i think about ON CHANGE but again Mouse is not used ... :?

Question : does ON CHANGE have any "This." :?:

---

i want to have a GRID only as Display which "refresh" Data every Second.
between time Client can store new Data into DBF / Array which are "load" on "refresh"

this are my Method under Xbase++
oLW1 is the Listview (GRID) Object

Code: Select all

METHOD OCalList:setCellColor( nRowPos, nColPos, nColorFG, nColorBG, lRepaint )
LOCAL lSuccess := .T.
   ::oLW1:lv_SetTextColor( nColorFG )           // LVM_SETTEXTCOLOR
   ::oLW1:lv_SetTextBkColor( nColorBG )		// LVM_SETTEXTBKCOLOR
RETURN lSuccess

METHOD OCalList:getCellColor( nRowPos, nColPos, nColorFG, nColorBG )
LOCAL lSuccess := .T.
   nColorFG := ::oLW1:lv_GetTextColor()		// LVM_GETTEXTCOLOR
   nColorBG := ::oLW1:lv_GetTextBkColor()	// LVM_GETTEXTBKCOLOR
RETURN lSuccess
does any HC_FUNC exist for those Method :?:
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: DynamicBackColor / DynamicForeColor

Post by andyglezl »

Otra opción pudiera ser con el control LABEL.
+------------------------------------------------------
Another option could be with the LABEL control.

Code: Select all

For i1 = 1 TO xRen
      @ <nRow> ,<nCol> LABEL <ControlName>
     For i2 = 1 TO xCol
          @ <nRow> ,<nCol> LABEL <ControlName>    
     Next
Next
@ <nRow> ,<nCol>
LABEL <ControlName>
[ OF | PARENT <ParentWindowName> ]
VALUE <cValue>
[ ACTION | ONCLICK |
ON CLICK <ActionProcedureName> | <bBlock> ]
[ WIDTH <nWidth> ]
[ HEIGHT <nHeight> ]
[ AUTOSIZE ]
[ FONT <cFontname> SIZE <nFontsize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP <cToolTipText> ]
[ BACKCOLOR <anBackColor> ]
[ FONTCOLOR <anFontColor>]
[ TRANSPARENT ]
[ RIGHTALIGN | CENTERALIGN ]
[ HELPID <nHelpId> ]
[ INVISIBLE ]
[ ENDELLIPSES ]
[ NOPREFIX ]
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DynamicBackColor / DynamicForeColor

Post by AUGE_OHR »

andyglezl wrote: Fri Nov 29, 2019 3:08 pm Otra opción pudiera ser con el control LABEL.
+------------------------------------------------------
Another option could be with the LABEL control.
THX for Tip.

Yes i can use Label but my Code have WC_LISTVIEW which i like to use under harbour/ HMG
i found in c:\hmg.3.4.4\SOURCE\c_grid.c Listview Macro

Code: Select all

HB_FUNC ( LISTVIEW_SETTEXTBKCOLOR )
{
	ListView_SetTextBkColor ( (HWND) HMG_parnl (1), (COLORREF) RGB(hb_parni(2), hb_parni(3), hb_parni(4)) ) ;
}

HB_FUNC ( LISTVIEW_SETTEXTCOLOR )
{
	ListView_SetTextColor ( (HWND) HMG_parnl (1), (COLORREF) RGB(hb_parni(2), hb_parni(3), hb_parni(4)) ) ;
}
i have try it but it still does not show Color ... hm
i will work on it and find it out
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DynamicBackColor / DynamicForeColor

Post by AUGE_OHR »

hi,

i found in c:\hmg.3.4.4\SOURCE\c_grid.c

Code: Select all

HB_FUNC ( SETBCFC )   // Set DynamicBackColor and Set DynamicForeColor
which use Customdraw and LPNMLVCUSTOMDRAW Structure.

so i search for more and found "ListView Custom Draw" in c_GridEx.c

Code: Select all

ListView_CustomDraw_GetHDC ( lParam ) --> hDC
ListView_CustomDraw_GetAction ( lParam , [ CellNavigation , hWndLV , nIndex ] )
GRID_SetBCFC ( lParam , nColorTextBk , nColorText , hFont )
but i found no Demo Sample.
did someone have a Sample with HMG Syntax :?:
have fun
Jimmy
Post Reply