Anyone has any idea why button in xBrowse flashes?

Anyone has any idea why button in xBrowse flashes?

Postby hua » Thu May 21, 2009 9:36 am

I placed an xBrowse control on a non-modal dialog and in the source code, I defined the following:
Code: Select all  Expand view

    ::oBrw:aCols[ 1 ]:nEditType := EDIT_GET_BUTTON
    ::oBrw:aCols[ 1 ]:addResource( "down" )
    ::oBrw:aCols[ 1 ]:nBtnBmp := 1
 


The good news, the button appears. The bad news, everytime the window is maximized or minimized, the button's image flashes. The flashing will only stop once I click the window's border.These can be seen here http://screencast.com/t/iSy86cLCWF . Anyone has any idea how to solve this? I'm using FWH 9.04

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Anyone has any idea why button in xBrowse flashes?

Postby Daniel Garcia-Gil » Fri May 22, 2009 1:16 pm

Hello Hua...

What version do you use?

Do you strech any column?
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Anyone has any idea why button in xBrowse flashes?

Postby hua » Sun May 24, 2009 10:52 am

Hi Daniel,
Thank you for replying. This is a self-contained sample to illustrate the problem. I am using FWH9.04
Code: Select all  Expand view

#include "fivewin.ch"
#include "xbrowse.ch"

#define BLK_ARR {space(5),space(50), 0.00, 0.00}

static oWnd, oDlg, oBrw
function main()
  local aFiledbf

  aFiledbf := { BLK_ARR, BLK_ARR}

  define window oWnd
  define dialog oDlg resource "journal" of oWnd

  redefine xbrowse oBrw id 101 of oDlg ;
     columns 1, 2, 3, 4 ;
     headers "Account", "Description", "Debit", "Credit" ;
     pictures "@!",,"@Z 999,999.99", "@Z 999,999.99" ;
     array aFiledbf ;
     fastedit lines cell update ;

     aeval(oBrw:aCols,{|o| o:lAutoSave := .t., o:nEditType := EDIT_GET})

    oBrw:lHScroll := .f.
    oBrw:nStretchCol := 2
    oBrw:bKeyDown := {| nKey | If( nKey == VK_F2, msginfo("Invoke picklist"), ) }
    oBrw:lAutoAppend := .t.
    oBrw:bPastEof := {|| aadd( oBrw:aArrayData, BLK_ARR ), ;
                           oBrw:GoLeftMost(), oBrw:GoDown(), oBrw:aCols[ 1 ]:edit() }


    oBrw:aCols[1]:bEditValid := {|oGet, oCol| ChkAccn(oGet, oCol)}

    oBrw:aCols[ 1 ]:nEditType := EDIT_GET_BUTTON
    oBrw:aCols[ 1 ]:addResource( "down" )
    oBrw:aCols[ 1 ]:nBtnBmp := 1

    with object oBrw:Debit
         :lTotal := .t.
         :nTotal := 0 //::nDrTotal
    end


    with object oBrw:Credit
         :lTotal := .t.
         :nTotal := 0
    end

  activate dialog oDlg   ;
    nomodal valid (oWnd:end(), .t.)

  oWnd:bGotFocus() := {|| oDlg:setFocus()}
  ACTIVATE WINDOW oWnd                                            ;
      ON INIT  (                                                  ;
                  oWnd:bResized := {|| resize()}                ;
               )                                                  ;
      MAXIMIZED
return nil
//----------------------------------------------------------------------
function ChkAccn(oGet, oCol)
  local lRet
  if left(oGet:value(),2) == "CA"
     lRet := .t.
  else
     msgalert("Invalid prefix")
    lRet := .f.
  endif
return lRet
//----------------------------------------------------------------------
function resize()
  #define SM_CXVSCROLL      2   // Width of arrow bitmap on a vertical scroll bar.

  oDlg:nWidth := oWnd:nWidth
  oDlg:nHeight := oWnd:nHeight //- oWnd:oMsgBar:nHeight
  oBrw:nWidth := oDlg:nWidth - GetSysMetrics(SM_CXVSCROLL)

return nil
//----------------------------------------------------------------------
 


The rc
Code: Select all  Expand view



journal DIALOG 0, 0, 440, 281
STYLE DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
CAPTION ""
FONT 10, "System"
{
 CONTROL "", 101, "TXBrowse", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 0, 28, 364, 202
}

down BITMAP LOADONCALL MOVEABLE DISCARDABLE
{
 '42 4D 06 01 00 00 00 00 00 00 76 00 00 00 28 00'
 '00 00 10 00 00 00 12 00 00 00 01 00 04 00 00 00'
 '00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00'
 '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
 '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
 '00 00 80 80 80 00 C0 C0 C0 00 00 00 FF 00 00 FF'
 '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
 '00 00 FF FF FF 00 88 88 88 88 88 88 88 88 88 88'
 '88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88'
 '88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88'
 '00 00 00 08 88 88 88 88 88 88 88 88 88 88 88 88'
 '88 80 88 88 88 88 88 88 88 00 08 88 88 88 88 88'
 '80 00 00 88 88 88 88 88 00 00 00 08 88 88 88 88'
 '88 00 08 88 88 88 88 88 88 00 08 88 88 88 88 88'
 '88 00 08 88 88 88 88 88 88 88 88 88 88 88 88 88'
 '88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88'
 '88 88 88 88 88 88'
}
 


I was also wondering how to get the footer to appear. I'm sure I'll have more questions as I slowly starts to get more familiar with xBrowse.

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Anyone has any idea why button in xBrowse flashes?

Postby nageswaragunupudi » Sun May 24, 2009 2:01 pm

if this line
oBrw:nStretchCol := 2
is removed or commented out the button does not flicker

This is a long outstanding bug
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Anyone has any idea why button in xBrowse flashes?

Postby nageswaragunupudi » Sun May 24, 2009 6:57 pm

This can be the fix in xbrowse.prg for this problem:

In xbrowse.prg:

1. Remove line "::ColStretch()" in METHOD Paint()
2. Add a new method in TXBrowse Class:
Code: Select all  Expand view
  METHOD Resize( nSizeType, nWidth, nHeight ) INLINE ( ::ColStretch(), Super:ReSize( nSizeType, nWidth, nHeight ) )
 

With this fix the button does not blink
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Anyone has any idea why button in xBrowse flashes?

Postby hua » Mon May 25, 2009 2:20 am

Thanks Rao! That solved it!

Any idea why the footers won't appear even though I changed the above xbrowse statement to:

redefine xbrowse oBrw id 101 of oDlg ;
columns 1, 2, 3, 4 ;
headers "Account", "Description", "Debit", "Credit" ;
pictures "@!",,"@Z 999,999.99", "@Z 999,999.99" ;
array aFiledbf ;
footers fastedit lines cell update ;
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Anyone has any idea why button in xBrowse flashes?

Postby nageswaragunupudi » Mon May 25, 2009 4:57 am

Possibly because of resizing in your application.
Try creating in a normal window or dialog, footers show up
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Anyone has any idea why button in xBrowse flashes?

Postby hua » Mon May 25, 2009 6:12 am

The footers appears once I remove WS_HSCROLL attribute from TXBrowse in the rc file.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: wartiaga and 86 guests