Page 1 of 4

Build 260

Posted: Mon Dec 08, 2014 4:07 am
by Tom
Hi, Roger.

Just installed, recompiled (including all apps) and tested eXpress++ 260. In _DCXBUTT.PRG, you should change this:

line 1221, was:

Code: Select all

oBitmap:Draw( oPS, aTarget )
is:

Code: Select all

oBitmap:Draw( oPS, aTarget, IIF(lDisabled .AND. ::disabledBmp,XBP_STATE_DISABLED,XBP_STATE_NORMAL) )
This will cause buttons carrying an icon as the caption to reflect their status correctly.

Besides, JD's balloon tooltip system does not work well. Balloons tend to flicker intensively, but in most of the cases, they won't even show up.

A suggestion for DC_ValidateDateRange():

The parameter array "aRange" should have a third parameter "lEmptyAllowed". In DC_ValidateDateRange():

Code: Select all

IF Empty(aDateRange) .OR. (Len(aDateRange) > 2 .AND. aDateRange[3] .AND. Empty(dDate))
  RETURN .T.
ENDIF
Reason: Either a date must be in the range or it can be empty.

Anyway, with build 260, my app creates fatals with every third or fourth dialog created:

Code: Select all

FATAL ERROR LOG
Error within the error handling!
..
@DC_GETLIST@I@EVENTLOOP(4131)
I played around with different settings for DC_ToolTipThread(), but this doesn't seem to be the cause.

I'm still looking for the reasons all my DCSAYs with subclassing now paint incorrectly. Looks like you add some space to them somewhere.

Re: Build 260

Posted: Mon Dec 08, 2014 5:08 am
by Tom
Add:

I added some debug code to find out what happens at "AppEvent()" in _DCGETBX.PRG creating a fatal with every third or fourth call. No wrong data at program termination:

mp1 {881, 370}
mp2 NIL
oXbp DC_XbpDialog1
nTimeOut NIL
::keyboardQueue {}
nWait 0

Besides, if a dialog containing that kind of pushbuttons:

Code: Select all

@ n,n DCPUSHBUTTON CAPTION {oIconEnabled,oIconDisabled} OBJECT oMyButton SIZE 3.2,1.1 ...
where "oIconEnabled/Disabled" are XbpIcon, I receive an IDSC, but not everytime:

Args:
ValType O CLASS DC_XbpPushButton
ValType O CLASS XbpIcon
Internal datastructures corrupted
Operation <XbpIcon>
at
DC_XBPPUSHBUTTON:WHENHIDEEVAL, 2372 <- _DCGETWHEN, 6104 <- DC_GETWHEN, 6066 ...

Re: Build 260

Posted: Mon Dec 08, 2014 6:04 am
by Tom
Another add:

Both problems (fatal and IDSC) seem to have the same context. Before I added some changes to my app, the pushbutton captions (icons, two for each state) were public objects. Now I moved them to functions:

Code: Select all

FUNCTION PhoneIcon()
STATIC oPhoneIcon := nil, lIsCreated := .F.
IF !lIsCreated
  lIsCreated := .T.
  oPhoneIcon := XpbIcon():New():Create()
  oPhoneIcon:Load(,PHONE_ICON,16,16)
ENDIF
RETURN oPhoneIcon
Anyway, no difference. A dialog containing this kind of buttons:

Code: Select all

@ n,n DCPUSHBUTTON CAPTION {IconEnabled(),IconDisabled()} OBJECT oMyButton SIZE 3.2,1.1 ...
will work once and crash if called for the second time (fatal at line 4131 of _DCGETBX.PRG, which is "nEvent := AppEvent ( ... )").

This worked with build 257.

It will not crash if the icons are LOCALs. Sometimes, it doesn't crash, but the buttons are not shown.

Re: Build 260

Posted: Mon Dec 08, 2014 10:18 am
by rdonnay
Thanks for the feedback, Tom.

I will work on these issues today and send you another update to test.

I don't understand why you are seeing extra space with your custom DCSAYs.
Can you show me a picture and some code?

Re: Build 260

Posted: Mon Dec 08, 2014 10:36 am
by Tom
Hi, Roger.

Thanks!

See attached pictures. "static1.jpg" shows how it should be. "static2.jpg" shows how this looks when using build 260.

This is how that kind of statics are created:

@ 1,1 DCSAY 'This is my static' SIZE 30,1 COLOR GRA_CLR_BLACK,GRA_CLR_BLUE SUBCLASS 'BoxWithGradientBackGroundCentered()'

The attached code shows how the subclass works. It paints a box with rounded corners and clips the path of the box. Afterwards, a gradient is painted in the clipped area. After that, the caption is painted.

Code: Select all

CLASS BoxWithGradientBackGroundCentered FROM DC_XbpStatic

INLINE METHOD Init(a,b,c,d,e,f,g,h)

::DC_XbpStatic:init(a,b,c,d,e,f,g,h)
::DrawMode := XBP_DRAW_OWNERADVANCED
::Draw := {|o,a|BoxWithGradientBackGroundDraw(o,a,::DC_XbpStatic,.T.)}

RETURN self
ENDCLASS

FUNCTION BoxWithGradientBackGroundDraw(oPs,aInfo,oObject,lCentered,lWordBreak)
local aLineAttrs := Array(GRA_AL_COUNT), aBoxAttrs := Array(GRA_AA_COUNT), nBackColor := oObject:SetColorBG(),;
      nParentBack := oObject:SetParent():SetColorBG(), nAlign := XBPALIGN_LEFT+XBPALIGN_VCENTER

DEFAULT lCentered := .F., lWordBreak := .F.
IF lCentered
  nAlign := XBPALIGN_HCENTER+XBPALIGN_VCENTER
ENDIF
IF lWordBreak
  nAlign := XBPALIGN_HCENTER+XBPALIGN_WORDBREAK
ENDIF
aLineAttrs[ GRA_AL_COLOR ]  := GraMakeRGBColor( { 167, 167, 167 } )
aBoxAttrs[GRA_AA_COLOR]     := nBackColor
aBoxAttrs[GRA_AA_SYMBOL] := GRA_SYM_BLANK
aLineAttrs[ GRA_AL_TYPE ]   := GRA_LINETYPE_SOLID
GraSetAttrLine( oPS, aLineAttrs)
GraSetAttrArea( oPS,aBoxAttrs)
GraBox(oPs,{ aInfo[ XBP_DRAWINFO_RECT, 1 ],aInfo[ XBP_DRAWINFO_RECT, 2 ] }, { aInfo[ XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },GRA_OUTLINE,4,4)
GraPathBegin(oPs)
GraBox(oPs,{ aInfo[ XBP_DRAWINFO_RECT, 1 ],aInfo[ XBP_DRAWINFO_RECT, 2 ] }, { aInfo[ XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },GRA_OUTLINE,4,4)
oPs:SetColor(oObject:SetColorFG())
GraPathEnd(oPs)
GraPathClip(oPs,.T.)
GraGradient(oPS,{ aInfo[ XBP_DRAWINFO_RECT, 1 ]+BoxOffsets()[1],aInfo[ XBP_DRAWINFO_RECT, 2 ]+BoxOffsets()[2] },;
               {{ aInfo[ XBP_DRAWINFO_RECT, 3 ]-BoxOffsets()[1],aInfo[ XBP_DRAWINFO_RECT, 4 ]-BoxOffsets()[2] }}, {nBackColor,GradOffset(nBackColor,65,.T.)} ,GRA_GRADIENT_VERTICAL)
GraPathClip(oPs,.F.)
GraCaptionStr( oPS, {aInfo[ XBP_DRAWINFO_RECT,1 ], aInfo[ XBP_DRAWINFO_RECT,2 ]}, { aInfo[ XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] }, Trim(oObject:Caption), nAlign )
RETURN .F.

FUNCTION BoxOffsets(nLeft,nUp)
STATIC nLeftOffset := 1, nUpOffset := 1
IF PCount() > 0
  nLeftOffset := nLeft
  nUpOffset   := nUp
ENDIF
RETURN {nLeftOffset,nUpOffset}

FUNCTION GradOffset(nColor) // just for the sample to work
RETURN GRA_CLR_DARKED

Re: Build 260

Posted: Mon Dec 08, 2014 10:37 am
by rdonnay
I'm going to give you the changes a few at a time.

Here is an updated _DCGETBX.PRG and _DCXBUTT.PRG.

_DCGETBX.PRG has the ValidateDateRange() update you requested.

_DCXBUTT.PRG has the oBitmap:draw() change you requested. Also, I removed all the code added to DC_XbpPushButton() by Jack Diujf in build 260. It caused problems for more than one customer. I didn't do enough testing because all my apps use DC_XbpPushButtonXP().

I agree that the balloon tip stuff is useless. I may take that out too or add a Get-Set function to enable it.

I don't know why you are having the errors.
I have several customers using build 260 who have not reported anything like this.
One of them has 350 workstations running his app with build 260 and hundreds of dialogs.

Re: Build 260

Posted: Mon Dec 08, 2014 10:50 am
by Tom
I'm going to build a sample with the icon buttons. Those only seem to fail if the XbpIcon-objects are PUBLIC or created in a Get-Set-Function. Sometimes, a second call to a dialog containing them leads to a fatal, sometimes, the buttons are not painted. No ownerdrawing there.

Re: Build 260

Posted: Mon Dec 08, 2014 10:51 am
by rdonnay
Tom -

I get the same results with 257 and 260 when running the below sample.
There is a difference with the Fit Padding at the top of the screen.
This was always a problem in eXpress++ and I finally resolved it in build 260.
The fit padding is now the same on all four sides.

Please run this sample with 257 and compare it to 260.

I need a sample from you that demonstrates your problem.
I can see it in your screen shot but I can't reproduce it.

Code: Select all

#INCLUDE "dcdialog.CH"
FUNCTION Main()

LOCAL GetList[0]

@ 1,1 DCSAY 'This is my static' SIZE 30,1 COLOR GRA_CLR_WHITE,GRA_CLR_BLUE ;
   SUBCLASS 'BoxWithGradientBackGroundCentered()'

DCREAD GUI FIT

RETURN nil

* -----------

PROC appsys ; RETURN

Re: Build 260

Posted: Mon Dec 08, 2014 10:53 am
by rdonnay
I'm going to build a sample with the icon buttons.
Please rebuild dclipx.dll with the _dcxbutt.prg I sent you to see if that fixed the problem.

Re: Build 260

Posted: Mon Dec 08, 2014 11:04 am
by Tom
Hi, Roger.
Please run this sample with 257 and compare it to 260.
It did this. The results are different: