Page 1 of 1
Problems in DCBROWSE using USEVISUALSTYLE
Posted: Fri Feb 19, 2016 11:51 am
by digitsoft
Good Afternoon Roger
This DC BROWSE command does not work if I use the USEVISUALSTYLE
SORTSCOLOR ASORT [1], ASORT [2];
SORTUCOLOR ASORT [3] ASORT [4];
SORTUPBITMAP ASORT [5];
SORTDOWNBITMAP ASORT [6];
Re: Problems in DCBROWSE using USEVISUALSTYLE
Posted: Fri Feb 19, 2016 1:36 pm
by rdonnay
Unfortunately, there is no way to control colors when using windows styles.
The :setColorBG() and :setColorFG() methods of the :heading object will not change the color, even if I set :heading:useVisualStyle to .FALSE.
I have not been able to find a workaround for this.
An alternative solution may be to change the font instead of the color. I will need to experiment with this.
Re: Problems in DCBROWSE using USEVISUALSTYLE
Posted: Fri Feb 19, 2016 2:25 pm
by Cliff Wiernik
I decided to not use visual styles for tabpages but used them for the tabpage scroll bars.
Re: Problems in DCBROWSE using USEVISUALSTYLE
Posted: Fri Feb 19, 2016 3:15 pm
by rdonnay
I solved the problem by adding 3 new elements to the DC_BrowseSort() array and 3 new clauses to the @..DCBROWSE command.
Code: Select all
/*
This example shows how to use DC_KeyOrder() to determine
if a browse column is an "indexed column" and can be
sorted. Indexed columns use the SORT clause of DCBROWSECOL
to color sortable columns blue and sorted columns red.
*/
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList[0], GetOptions, i, oBrowse, aStruct, nKeyOrder, bSort, ;
cFieldName, bEval, bField, aSort
aSort := DC_BrowseSort()
aSort[9] := '11.Lucida Console Bold Italic'
aSort[10] := '11.Lucida Console Italic'
aSort[11] := '10.Lucida Console'
DC_LoadRdds()
USE ..\..\data\customer INDEX ..\..\data\customer VIA 'FOXCDX'
aStruct := CUSTOMER->(dbStruct())
@ 0,0 DCBROWSE oBrowse SIZE 100, 20 ;
PRESENTATION DC_BrowPres() ;
USEVISUALSTYLE ;
SORTSFONT '11.Lucida Console Bold Italic' ;
SORTUFONT '11.Lucida Console Italic' ;
SORTNFONT '10.Lucida Console'
FOR i := 1 TO Len(aStruct)
cFieldName := aStruct[i,1]
nKeyOrder := CUSTOMER->(DC_KeyOrder(cFieldName))
IF nKeyOrder > 0
bSort := _SortBlock(nKeyOrder)
ELSE
bSort := nil
ENDIF
bField := FieldWBlock(cFieldName,'CUSTOMER')
DCBROWSECOL DATA bField ;
HEADER cFieldName WIDTH aStruct[i,3] PARENT oBrowse ;
SORT bSort _DEFAULT i==3
NEXT
DCREAD GUI FIT TITLE 'Browse with Sort' SETAPPWINDOW
RETURN nil
* --------------
STATIC FUNCTION _SortBlock( nKeyOrder )
RETURN {||CUSTOMER->(OrdSetFocus(nKeyOrder))}
* -------------
PROC appsys
RETURN
Copy DCDIALOG.CH to your \exp20\include folder.
Copy _DCXBROW.PRG to your \exp20\source\dclipx folder and run build19_sl1.bat or build20.bat to rebuild dclipx.dll
Copy VisualStyle.Prg and VisualStyle.Exe.Manifest to your \exp20\samples\browse folder.
Run GMAKE VisualStyle to create VisualStyle.Xpj. GMAKE.BAT is in your \exp20\util folder.
Run PBUILD VisualStyle to build VisualStyle.Exe.
This sample program uses visual style for the browse with a different font for selected and unselected sort columns.
This change will be in build 264.