FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH8.11 Dialog Flickers when Refresh
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Thu Dec 18, 2008 07:02 AM
Hi all and happy holidays!!! :-)


Whenever I fire-up oDlg:Refresh(), all controls from that dialog flickers (not smooth redrawn)....


I tried:
...
oDlg:BeginPaint()
oDlg:Refresh()
oDlg:EndPaint()
...


RC of Dialog and controls using (Resource Editor 2.1) ResEd:
CBS_COMPARISON DIALOGEX 5,6,495,413
FONT 10,"Courier",0,0
STYLE WS_VISIBLE|WS_OVERLAPPEDWINDOW|DS_CENTER
EXSTYLE WS_EX_TOOLWINDOW|0x80800000
BEGIN
  CONTROL "Local CBS",1007,"Button",WS_CHILD|WS_VISIBLE|BS_LEFTTEXT|BS_GROUPBOX,1,1,243,202
  CONTROL "",1002,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,6,12,237,190
  CONTROL "",1004,"TSplitter",WS_CHILD|WS_VISIBLE,246,0,3,207
  CONTROL "Server CBS",1008,"Button",WS_CHILD|WS_VISIBLE|BS_LEFTTEXT|BS_GROUPBOX,250,1,244,202
  CONTROL "",1003,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,255,12,238,190
  CONTROL "",1005,"TSplitter",WS_CHILD|WS_VISIBLE,0,206,494,3
  CONTROL "Erroneous Entry",1009,"Button",WS_CHILD|WS_VISIBLE|BS_LEFTTEXT|BS_GROUPBOX,1,212,493,181
  CONTROL "",1001,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,6,224,487,168
  CONTROL "Fix Duplicate  ",1006,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_RIGHT,223,395,49,16
  CONTROL "Synchronize",1010,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,41,398,58,9
  CONTROL "Refresh  ",1011,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_RIGHT,1,395,38,16
END



Any suggestion or solution would be highly appreciated.

Regards,
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Fri Dec 19, 2008 12:39 AM

Anybody? Mr. Antonio?

:wink:

Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Fri Dec 19, 2008 12:49 AM

Frances,

You should only refresh the controls that you want to be repainted, using oDlg:Update(), or oControl:Refresh()

oDlg:Refresh() causes flickering as it forces all controls to be repainted.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Fri Dec 19, 2008 03:27 AM
Antonio Linares wrote:Frances,

You should only refresh the controls that you want to be repainted, using oDlg:Update(), or oControl:Refresh()

oDlg:Refresh() causes flickering as it forces all controls to be repainted.



That's true. But my reason to include the oDlg:Refresh() on Splitter issue when I click on the spliter (of the above code), the lower controls (group, checkbox and button) disappear and only oDlg:Refresh() fix's the problem but flickering is kinda annoying. :-)

here's the screen shot before/after I clicked the vertical splitter without the oDlg:refresh() declared after ON CHANGE clause of REDEFINE SPLITTER:





Regards,
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Fri Dec 19, 2008 01:25 PM

Frances,

Try to refresh just those controls:

oGroup:Refresh()
oCheckbox:Refresh()
oButton:Refresh()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 12:30 AM
Antonio Linares wrote:Frances,

Try to refresh just those controls:

oGroup:Refresh()
oCheckbox:Refresh()
oButton:Refresh()



Hello Mr. Antonio,

I already tried this:
...
REDEFINE SPLITTER oVSplit ID 1004 ;
         VERTICAL _3DLOOK ;
         PREVIOUS CONTROLS aGroup[1], oLocalXbrw ;
         HINDS CONTROLS aGroup[2], oServerXbrw;
         OF oDlg UPDATE;
         ON CHANGE ( aGroup[3]:Refresh(), oSync:Refresh() ) //oDlg:Refresh()
...


But the results is the same... missing those controls.

Do we have to live with the "flickering" on oDlg:Refresh() ???


Regards,
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 12:49 AM

Frances,

If we could have a small and simple example to reproduce it here, it may be easier to find a fix for it, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 01:25 AM
Antonio Linares wrote:Frances,

If we could have a small and simple example to reproduce it here, it may be easier to find a fix for it, thanks



Hello again Sir!

Here is the exact skeleton of that procedure array version. notice that the oDlg:Refresh() is commented.

Code:
PROCEDURE uTest_Me()
 LOCAL bErrorHandler, oErr
 LOCAL oDlg, oBtn, oSync
 LOCAL oVSplit, oHSplit
 LOCAL cOldOrder,;
       cOldRec

 LOCAL aFont[3],;
       aGroup[3]

 LOCAL lGo := .F.,;
       lSync := .F.

 STATIC aLocal   := { {'','','','','',''} },;
        aServer  := { {'','','','','',''} },;
        aCompare := { {'','','','',''} }

 STATIC oLocalXbrw,;
        oServerXbrw,;
        oCompareXbrw

 bErrorHandler := ErrorBlock( {|oError| Break( oError) })
 BEGIN SEQUENCE

       DEFINE FONT aFont[ 1 ] Name 'Tahoma' Size 0, -14 BOLD

       DEFINE DIALOG oDlg RESOURCE 'CBS_COMPARISON';
              OF oMDIFrame:oWndClient PIXEL

              REDEFINE GROUP aGroup[1] ID 1007;
                       OF oDlg TRANSPARENT FONT aFont[1];
                       UPDATE

              REDEFINE GROUP aGroup[2] ID 1008;
                       OF oDlg TRANSPARENT FONT aFont[1];
                       UPDATE

              REDEFINE GROUP aGroup[3] ID 1009;
                       OF oDlg TRANSPARENT FONT aFont[1];
                       UPDATE

              REDEFINE XBROWSE oLocalXbrw;
                       OF oDlg ID 1002;
                       ARRAY aLocal AUTOSORT UPDATE


              REDEFINE XBROWSE oServerXbrw;
                       OF oDlg ID 1003;
                       ARRAY aServer AUTOSORT UPDATE;
                       COLSIZES   ,; //100,;
                                  ,; // 90,;
                                  60,;
                                  35,;
                                  210;


              REDEFINE SPLITTER oVSplit ID 1004 ;
                       VERTICAL _3DLOOK ;
                       PREVIOUS CONTROLS aGroup[1], oLocalXbrw ;
                       HINDS CONTROLS aGroup[2], oServerXbrw;
                       OF oDlg UPDATE;
                       //ON CHANGE oDlg:Refresh()

              REDEFINE XBROWSE oCompareXbrw;
                       OF oDlg ID 1001;
                       ARRAY aCompare AUTOSORT UPDATE

              REDEFINE SPLITTER oHSplit ID 1005 ;
                       HORIZONTAL _3DLOOK ;
                       PREVIOUS CONTROLS aGroup[1],oLocalXbrw,oVSplit,aGroup[2],oServerXbrw ;
                       HINDS CONTROLS aGroup[3], oCompareXbrw ;
                       OF oDlg UPDATE;
                       //ON CHANGE oDlg:Refresh()

              REDEFINE CHECKBOX oSync VAR lSync ;
                       ID 1010 OF oDlg

              REDEFINE BUTTONBMP ID 1011 OF oDlg

              REDEFINE BUTTONBMP ID 1006 OF oDlg

       ACTIVATE DIALOG oDlg



 RECOVER USING oErr

         If ValType( oErr ) == "O"

            MsgAlert( '::SubSystem   ' + cValToChar( oErr:SubSystem   ) + CRLF +;
                      '::SubCode     ' + cValToChar( oErr:SubCode     ) + CRLF +;
                      '::Operation   ' + cValToChar( oErr:Operation   ) + CRLF +;
                      '::Description ' + cValToChar( oErr:Description ) + CRLF +;
                      '::Argument    ' + valToPrg( oErr:Args ), 'uCBS_Comparison()' )

         End

 END SEQUENCE
 ErrorBlock( bErrorHandler)

RETURN



Now using ResEd 2.2

RC:
CBS_COMPARISON DIALOGEX 5,6,495,413
FONT 10,"Courier",0,0
STYLE WS_VISIBLE|WS_OVERLAPPEDWINDOW|DS_CENTER
EXSTYLE WS_EX_TOOLWINDOW|0x80800000
BEGIN
  CONTROL "Local CBS",1007,"Button",WS_CHILD|WS_VISIBLE|BS_RIGHTBUTTON|BS_GROUPBOX,1,1,243,202
  CONTROL "",1002,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,6,12,237,190
  CONTROL "",1004,"TSplitter",WS_CHILD|WS_VISIBLE,246,0,3,207
  CONTROL "Server CBS",1008,"Button",WS_CHILD|WS_VISIBLE|BS_RIGHTBUTTON|BS_GROUPBOX,250,1,244,202
  CONTROL "",1003,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,255,12,238,190
  CONTROL "",1005,"TSplitter",WS_CHILD|WS_VISIBLE,0,206,494,3
  CONTROL "Erroneous Entry",1009,"Button",WS_CHILD|WS_VISIBLE|BS_RIGHTBUTTON|BS_GROUPBOX,1,212,493,181
  CONTROL "",1001,"TXBrowse",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,6,224,487,168
  CONTROL "Remove Duplicate  ",1006,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_RIGHT,217,395,61,16
  CONTROL "Synchronize",1010,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,41,398,58,9
  CONTROL "Refresh  ",1011,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_RIGHT,1,395,38,16
END



RESULT:
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 02:21 AM
Frances,

We have tried to implement double buffer painting in the dialog but without success :-)

Please notice that this flickering is not specific from 8.11. Previous FWH versions may have it too.
#include "FiveWin.ch"
#include "splitter.ch"
#include "xbrowse.ch"

PROCEDURE uTest_Me()
 LOCAL bErrorHandler, oErr
 LOCAL oDlg, oBtn, oSync
 LOCAL oVSplit, oHSplit
 LOCAL cOldOrder,;
       cOldRec

 LOCAL aFont[3],;
       aGroup[3]

 LOCAL lGo := .F.,;
       lSync := .F.

 STATIC aLocal   := { {'','','','','',''} },;
        aServer  := { {'','','','','',''} },;
        aCompare := { {'','','','',''} }

 STATIC oLocalXbrw,;
        oServerXbrw,;
        oCompareXbrw

 bErrorHandler := ErrorBlock( {|oError| Break( oError) })
 BEGIN SEQUENCE

       DEFINE FONT aFont[ 1 ] Name 'Tahoma' Size 0, -14 BOLD

       DEFINE DIALOG oDlg RESOURCE 'CBS_COMPARISON';
              PIXEL

              REDEFINE GROUP aGroup[1] ID 1007;
                       OF oDlg TRANSPARENT FONT aFont[1]
                       

              REDEFINE GROUP aGroup[2] ID 1008;
                       OF oDlg TRANSPARENT FONT aFont[1]
                       

              REDEFINE GROUP aGroup[3] ID 1009;
                       OF oDlg TRANSPARENT FONT aFont[1]
                       

              REDEFINE XBROWSE oLocalXbrw;
                       OF oDlg ID 1002;
                       ARRAY aLocal AUTOSORT


              REDEFINE XBROWSE oServerXbrw;
                       OF oDlg ID 1003;
                       ARRAY aServer AUTOSORT ;
                       COLSIZES   ,; //100,;
                                  ,; // 90,;
                                  60,;
                                  35,;
                                  210;


              REDEFINE SPLITTER oVSplit ID 1004 ;
                       VERTICAL _3DLOOK ;
                       PREVIOUS CONTROLS aGroup[1], oLocalXbrw ;
                       HINDS CONTROLS aGroup[2], oServerXbrw;
                       OF oDlg UPDATE;
                       ON CHANGE oDlg:Refresh()

              REDEFINE XBROWSE oCompareXbrw;
                       OF oDlg ID 1001;
                       ARRAY aCompare AUTOSORT

              REDEFINE SPLITTER oHSplit ID 1005 ;
                       HORIZONTAL _3DLOOK ;
                       PREVIOUS CONTROLS aGroup[1],oLocalXbrw,oVSplit,aGroup[2],oServerXbrw ;
                       HINDS CONTROLS aGroup[3], oCompareXbrw ;
                       OF oDlg UPDATE;
                       //ON CHANGE oDlg:Refresh()

              REDEFINE CHECKBOX oSync VAR lSync ;
                       ID 1010 OF oDlg

              REDEFINE BUTTONBMP ID 1011 OF oDlg

              REDEFINE BUTTONBMP ID 1006 OF oDlg
              
       Override Method EraseBkGnd In Class TDialog With DlgNoErase

       Override Method Paint In Class TDialog With DlgPaint
      

       ACTIVATE DIALOG oDlg



 RECOVER USING oErr

         If ValType( oErr ) == "O"

            MsgAlert( '::SubSystem   ' + cValToChar( oErr:SubSystem   ) + CRLF +;
                      '::SubCode     ' + cValToChar( oErr:SubCode     ) + CRLF +;
                      '::Operation   ' + cValToChar( oErr:Operation   ) + CRLF +;
                      '::Description ' + cValToChar( oErr:Description ) + CRLF +;
                      '::Argument    ' + cvalTochar( oErr:Args ), 'uCBS_Comparison()' )

         End

 END SEQUENCE
 ErrorBlock( bErrorHandler)

RETURN

function DlgNoErase() ; return 1

function DlgPaint()

   local Self := QSelf()
   local aInfo := ::DispBegin()

   FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
   
   ::DispEnd( aInfo )
   
return 1
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 02:26 AM

Frances,

Solved! :-)

Please include this code in your function and no need to refresh the dialog:

function IsAppThemed() ; return .F.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 04:07 AM
Antonio Linares wrote:Frances,

Solved! :-)

Please include this code in your function and no need to refresh the dialog:

function IsAppThemed() ; return .F.




GREAT!!! Works like a charm.... NO FLICKERING TOO

Thanks GURU!

Please enlighten me of what happened there why we need to override the function....


PS
- looking for more issues.

Regards,
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWH8.11 Dialog Flickers when Refresh
Posted: Sat Dec 20, 2008 09:37 AM
Frances,

I tested your example without themes and worked fine, that made me think that it was related with the themes :-)

It seems as these lines in control.prg were causing it:
      if IsAppThemed() .and. Upper( ::ClassName() ) $ "TCHECKBOX;TRADIO;TGROUP"
         DrawPBack( ::hWnd,  hDC )
      endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
FWH8.11 Dialog Flickers when Refresh
Posted: Mon Dec 22, 2008 12:39 AM

Antonio,

The themes must work for aesthetic winxp-like controls.

If we override the function IsAppThemed() all of my controls are in bad shape on winxp themed.

It's similar to TGROUP issue on themed.

Well, a workaround is needed.

This situation suggest that FWH + Theme has serious issue.

I hope I can find some workaround too.

Regards,

Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15

Continue the discussion