FWH8.11 Dialog Flickers when Refresh

FWH8.11 Dialog Flickers when Refresh

Postby fraxzi » Thu Dec 18, 2008 7:02 am

Hi all and happy holidays!!! :)


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


I tried:
Code: Select all  Expand view  RUN
...
oDlg:BeginPaint()
oDlg:Refresh()
oDlg:EndPaint()
...


RC of Dialog and controls using (Resource Editor 2.1) ResEd:
Code: Select all  Expand view  RUN
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,
Last edited by fraxzi on Mon Dec 22, 2008 12:31 am, edited 2 times in total.
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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby fraxzi » 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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby fraxzi » Fri Dec 19, 2008 3: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:

Image

Image

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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby Antonio Linares » Fri Dec 19, 2008 1:25 pm

Frances,

Try to refresh just those controls:

oGroup:Refresh()
oCheckbox:Refresh()
oButton:Refresh()
regards, saludos

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

Postby fraxzi » 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:
Code: Select all  Expand view  RUN
...
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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby fraxzi » Sat Dec 20, 2008 1: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:
Code: Select all  Expand view  RUN

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:
Code: Select all  Expand view  RUN

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:
Image
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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby Antonio Linares » Sat Dec 20, 2008 2: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.
Code: Select all  Expand view  RUN
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Dec 20, 2008 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby fraxzi » Sat Dec 20, 2008 4: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby Antonio Linares » Sat Dec 20, 2008 9: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:
Code: Select all  Expand view  RUN
      if IsAppThemed() .and. Upper( ::ClassName() ) $ "TCHECKBOX;TRADIO;TGROUP"
         DrawPBack( ::hWnd,  hDC )
      endif
regards, saludos

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

Postby fraxzi » 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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: MaxP and 85 guests