DCBROWSE, visual styles and foreground colors

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCBROWSE, visual styles and foreground colors

#11 Post by skiman »

Tom,

I'm not using icons on my buttons, I'm using bitmap.

Code: Select all

@ 10,10 CJPushButton oBut1 ;
Size 130,70 ; 
BITMAP ABO_KLANTN ;
Caption fMessage(1000) ;  
...
Transparency is working without problem.
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBROWSE, visual styles and foreground colors

#12 Post by Tom »

Hi, Chris.

I also use bitmaps on some of those buttons, and this works. But I have the need to support icon files, since we deliver a huge icon collection and allow to set those (or icons bought/imported by the user) for toolbars and hotbutton-panes (on docking panes).
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCBROWSE, visual styles and foreground colors

#13 Post by skiman »

Tom,

I never used icons on buttons, I thought that Jimmy posted once that the codejock buttons were working with icons, and the problem were the bitmaps. :?:

In an attempt to try to make your code more universal, i changed it a little.

Code: Select all

IF CrLf() $ xData // x lines automatically calculated.
  aLines := dc_tokenarray(xData,crlf())
  nLines := len(aLines)
  nHeight := nHeight*nLines   // seems this isn't working?
  for x = 1 to nLines
   GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] }, aLines[x], nAlign )				
  next
else
    GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] }, xData, nAlign )
endif
It would be nice to find also a solution the specify the font and color for each line. Maybe by adding it to the dcbrowsecolumn command, if the font is an array, it can be used.
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBROWSE, visual styles and foreground colors

#14 Post by Tom »

Hi, Chris.

nHeight is the overall height of the cell/row. If you place more than one string inside the cell, you have to calculate the offset for each string, which is nHeight/nLines. At GraCaptionStr(), the parameter "aInfo[ XBP_DRAWINFO_RECT, 4 ]" is the y-coordinate (line) inside the cell. The first line can be placed there, since aInfo[ XBP_DRAWINFO_RECT, 4 ] is the upmost line. The other lines should be placed below this, substracting the calulated nHeigth from this. Remember to set the alignment (last parameter) to 0 (zero), since XBPALING_VCENTER calculates a position in the midth of the row. Also remember to increase the cell/row height parameter in your presentation array!
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBROWSE, visual styles and foreground colors

#15 Post by Tom »

Hi, Chris.

Add: If you force the CustomDrawCell-method to paint as many lines as found in the cell, you create a dynamic mechanism for a static element! The cell height (remember to increase it!) is constant, and this leads to ugly results, if you paint more stuff on the cell than space available. A better idea would be an iVar of the class (or of a new subclass for DC_XbpColumn, something like 'DispLines') which sets the number of to-be-displayed lines. In my method, I paint 3 (or 'DispLines') lines if there is at least more than one - or only one line using the alignment parameters. After testing a while, this seems to give the nicest results.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCBROWSE, visual styles and foreground colors

#16 Post by skiman »

Tom,

Hm, I understand what you mean. In my application I would use customer->name+crlf()+customer->name2, so it wouldn't be that dynamic. In the case that name2 is empty, if would still display two lines.

I will have to experiment a little further to see what gives the best result for me.

Is that 'zebra-striping' of your sample based on the striping from Jack Duijf?
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBROWSE, visual styles and foreground colors

#17 Post by Tom »

Hi, Chris.
Is that 'zebra-striping' of your sample based on the striping from Jack Duijf?
It's simply this:

Code: Select all

DC_BrowseColor( { nil, GRA_CLR_WHITE, nil, GraMakeRGBColor({254,230,188}) } )
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCBROWSE, visual styles and foreground colors

#18 Post by skiman »

Tom,

I'm using almost in every dcbrowse the color clause. In that case the dc_browsecolor() isn't working.

It should be possible to modify the browse so that the color clause gets highest priority, and otherwise the dc_browsecolor is used.
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBROWSE, visual styles and foreground colors

#19 Post by Tom »

Hi, Chris.

You're right - DC_BrowseColor() should fire if the color codeblock returns nil instead of a color array. I added an own function "BrowseToggleColor()" for browses which have colored cells in some, but not in all cases:

DCBROWSECOL ... COLOR {||IF(TbColorize(db->data),TbGetColor(db->data),BrowseToggleColor(db->OrdKeyNo()))}

"BrowseToggleColor(n)" returns a part of the DC_BrowseColor-array, depending on 'n' (odd or even). This works good with arrays (DC_BrowseRow()), but not very excellent with tables with deleted records. Anyway, it works better than DC_BrowseColor sometimes, since DC_BrowseColor changes the color order with every refresh if the number of rows is odd. ;)
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCBROWSE, visual styles and foreground colors

#20 Post by Auge_Ohr »

Tom wrote:There is something basically wrong with the XBPSYSCLR_TRANSPARENT mechanism in 1.9 SL1. Sometimes, this doesn't reflect the AutomationTranslateColor()-results correctly.
YES

using Codejock SkinFrameWork you can "see" that SL1
a.) use only System "default" Skin when call GraBackgound()
b.) Ownerdraw Menu have Problem with visual Style using "other" Skin
c.) most Xbpart, derived from XbpWindow(), will show XBPSYSCLR_TRANSPARENT as "black" when used as Parent with activeX

still hope Alaska will fix it, as they promise, to support Codejock Tools
greetings by OHR
Jimmy

Post Reply