Loosing buttons in RibbonBar

User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Loosing buttons in RibbonBar

Post by lucasdebeltran »

Antonio,

It happens also in Windows Vista and XP.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Loosing buttons in RibbonBar

Post by Antonio Linares »

Lucas,

Could you provide an example to reproduce it ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Loosing buttons in RibbonBar

Post by lucasdebeltran »

Antonio,

Just the sample at fwh\samples

It happens ramdonly.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Loosing buttons in RibbonBar

Post 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...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Loosing buttons in RibbonBar

Post 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
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: Loosing buttons in RibbonBar

Post 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.
Best Regards,
Ruediger Alich

---
HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Loosing buttons in RibbonBar

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Loosing buttons in RibbonBar

Post 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

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

#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! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Loosing buttons in RibbonBar

Post 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....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Loosing buttons in RibbonBar

Post 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
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Loosing buttons in RibbonBar

Post 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.
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Loosing buttons in RibbonBar

Post 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....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: Loosing buttons in RibbonBar

Post 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. :(
Best Regards,
Ruediger Alich

---
HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Loosing buttons in RibbonBar

Post 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... :-(
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply