Page 2 of 2

Re: Loosing buttons in RibbonBar

Posted: Thu Jul 19, 2012 12:28 pm
by lucasdebeltran
Antonio,

It happens also in Windows Vista and XP.

Re: Loosing buttons in RibbonBar

Posted: Thu Jul 19, 2012 1:38 pm
by Antonio Linares
Lucas,

Could you provide an example to reproduce it ? thanks

Re: Loosing buttons in RibbonBar

Posted: Thu Jul 19, 2012 2:33 pm
by lucasdebeltran
Antonio,

Just the sample at fwh\samples

It happens ramdonly.

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 2:31 am
by Bayron
Just tried to compile using xHarbour from SVN and lost all the buttons from ribbonbar again after a couple of uses...

Actually I'm using xHarbour 1.2.1 Rev 9388 and never experienced this problem...

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 6:43 am
by Enrico Maria Giordano
I think xHarbour has nothing to do with the buttons of the ribbonbar. We have to dig deep inside FWH...

EMG

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 9:04 am
by IBTC
Enrico Maria Giordano wrote:I think xHarbour has nothing to do with the buttons of the ribbonbar. We have to dig deep inside FWH...


You are right. About 1 week ago a customer reported about this problem and yesterday I saw it the first time also, but couldn't reproduce it again. It was with FWH 12.05, BCC and Harbour 3.0 on Windows XP. Our customer saw it on Windows 7.

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 9:58 am
by Antonio Linares
We are going to place traces in all the painting process of the buttons to find where the problem comes from.

Thanks to all for your feedback and patience :-)

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 11:43 am
by Antonio Linares
The function that paints the bitmaps on the buttons is TransBmp(). In fact if you add this function to your main PRG you will see no bitmaps in the buttons:

Code: Select all | Expand

function TransBmp()

return nil


Ok, so now here you have a modified version of TransBmp() that traces all its activity to find where it may fail. Please copy it to the bottom of your main PRG:

Code: Select all | Expand

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

static void TransBmp( HBITMAP hBitmap, int iXsize, int iYsize,
               COLORREF rgbTransparent, HDC hDC,
               int iXOffset, int iYOffset, int iWidth, int iHeight )
{
  HDC mDC, nDC;
  HBITMAP hMask, hBmOld1, hBmOld2;
  LPBYTE lpBits;

  mDC = CreateCompatibleDC( hDC );
 
  if( mDC )
  {
    hBmOld1 = ( HBITMAP ) SelectObject( mDC, hBitmap );

    lpBits = ( LPBYTE ) hb_xgrab( iXsize * iYsize * 2 );
    if( lpBits )
    {
      hMask = CreateBitmap( iXsize, iYsize, 1, 1, lpBits );
      if( hMask )
      {
        nDC = CreateCompatibleDC( hDC );
        if( nDC )
        {
          hBmOld2 = ( HBITMAP ) SelectObject( nDC, hMask );
          SetBkColor( mDC, rgbTransparent );

          if( ! BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY ) )
             MessageBox( 0, "BitBlt() failed from TransBmp()", "error", 0 );            

          SetStretchBltMode( hDC, COLORONCOLOR );

          if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      mDC, 0, 0, iXsize, iYsize,
                      SRCINVERT ) )
             MessageBox( 0, "StretchBlt() 1 failed from TransBmp()", "error", 0 );            

          if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      nDC, 0, 0, iXsize, iYsize,
                      SRCAND ) )
             MessageBox( 0, "StretchBlt() 2 failed from TransBmp()", "error", 0 );            

          if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
                      mDC, 0, 0, iXsize, iYsize,
                      SRCINVERT ) )
             MessageBox( 0, "StretchBlt() 3 failed from TransBmp()", "error", 0 );            

          SelectObject( nDC, hBmOld2 );
          DeleteDC( nDC );
        }
        else
           MessageBox( 0, "can't create compatible DC 2 from TransBmp()", "error", 0 );
       
        DeleteObject( hMask );
      }
      hb_xfree( lpBits );
    }
    else
     MessageBox( 0, "hb_xgrab() failed from TransBmp()", "error", 0 );
       
    SelectObject( mDC, hBmOld1 );
    DeleteDC( mDC );
  }
  else
     MessageBox( 0, "can't create compatible DC 1 from TransBmp()", "error", 0 );
}

HB_FUNC( TRANSBMP )
{
   TransBmp( ( HBITMAP ) hb_parnl( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ),
             ( HDC ) hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ),
             hb_parnl( 9 ) );
}

#pragma ENDDUMP


If at any moment it fails a msg will be displayed that will help us to know what it is going on. Thanks for your help! :-)

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 2:57 pm
by Bayron
I placed this function in my prg, at first I was able to reproduce the problem once without getting any messages... But I noticed that one bitmap from my ribbonbar didn't desapear...

The only difference with the rest is that it was smaller, so I reduced the images from 112 to 96 pixels, and so far I have not loose the bitmaps from the ribbonbar... but I have lost other resources from dialogs...

This got me thinking that it may be something else... Could it be Pelles 7.0 release candidate #4????

This story to be continued....

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 6:17 pm
by Bayron
Other steps I took are:

Installing Pelles C 7.0 final release

Open and Modify all the images and save them with the new Pelles C...

I have gone from loosing resources every time i used the software to not being able to reproduce the problem so far...

Just for Info: I'm using:
Windows 7 Ultimate
Pelles C
.Res files
Uestudio 10.10

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 6:35 pm
by Enrico Maria Giordano
Unfortunately, I've seen the problem using BCC too. :-(

EMG

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 6:57 pm
by Gale FORd
In one of my applications it shows a set of hazardous placard images, up to 4, of a given UN code. About a year ago I upgraded FWH.
The application would appear to randomly loose the ability to show images on buttons and other places.
I finally tracked it down to the hazardous placard images. If I commented that portion of the code out it would keep working. With the code in, it would start loosing images somewhere down the road.
I opened each of the images and changed them to 256 colors indexed 8 bit. After that I had no more problems with images.
I do not know now what their original format was but those particular images were screwing up my app. It was driving me crazy with support calls.

Re: Loosing buttons in RibbonBar

Posted: Fri Jul 27, 2012 7:52 pm
by Bayron
Hi Gale,

I had problems with this images before as well, but what is driving me crazy is that only happens in Harbour 3.0 and up, and in SVN xHarbour...

With xHarbour 1.2.1 Rev 9388 it does not happens at all...

As I pointed out before, modifying the images and saving them again, I have gone from every time to It may happen or It may not happen....

Re: Loosing buttons in RibbonBar

Posted: Fri Nov 02, 2012 12:10 pm
by IBTC
Antonio Linares wrote:If at any moment it fails a msg will be displayed that will help us to know what it is going on. Thanks for your help! :-)


I had this situation today again, but there was no message. So it seams that the reason is somewhere else.

Could the reason maybe in pressing a key in a special situation before? This time when I saw the problem again I closed a dialog window with the key ESC (and I also used other keys before, like DEL) and not with the mouse as usual. But I couldn't reproduce it again. :(

Re: Loosing buttons in RibbonBar

Posted: Fri Nov 02, 2012 1:37 pm
by Antonio Linares
Ruediger,

FWH\samples\FiveDBU.prg is a good example to test it. I have seen ocasionally the disappearing images issue, but I am unable to reproduce it.

I am sure we will be able to locate it and fix it, but for now we don't how to reproduce it... :-(