SAY ... TRANSPARENT are not wordwrapping

SAY ... TRANSPARENT are not wordwrapping

Postby byte-one » Tue Nov 11, 2008 4:32 pm

On a dialog TRANSPARENT a long text from say are not wrapped in next line.

This is with DIALOG......TRANSPARENT

Image

and this without TRANSPARENT

Image

If i change the text and call oDlg:update(), then the text is shown ok.

ANTONIO, this behavior is from the call of FixSays(::hWnd) in method Initiate from TDIALOG which are only called when the dialog is transparent.
Last edited by byte-one on Fri Nov 21, 2008 10:28 am, edited 1 time in total.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby byte-one » Thu Nov 20, 2008 2:55 pm

Antonio, any suggestion?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby byte-one » Mon Nov 24, 2008 11:49 am

Antonio, do you have any suggestion to this urgent (not only for me!) problem?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby Antonio Linares » Mon Nov 24, 2008 1:41 pm

Günther,

In FixSays() we use this code:
Code: Select all  Expand view
      else   
         DrawText( hDC, text, lstrlen( text ), &rct, DT_LEFT ); // | DT_WORDBREAK );

I guess that we need to check if the text includes CRLFs so the style DT_WORDBREAK should be included too.
regards, saludos

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

Postby Antonio Linares » Mon Nov 24, 2008 1:44 pm

Günther,

Here you have the source code for FixSays() just in case that you want to do some tests with it:
Code: Select all  Expand view
void WindowBoxBlack( HDC hDC, RECT * pRect );

LRESULT static CALLBACK LabelProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
   if( uMsg == WM_ERASEBKGND )
   {
      return 1;
   } 

   else if( uMsg == WM_UPDATEUISTATE ) // SAYs were erased when pressing ALT
   {   
      LONG lResult = CallWindowProc( ( FARPROC) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
      InvalidateRect( hWnd, NULL, TRUE );
      return lResult;
   }

   else if( uMsg == WM_PAINT )
   {
      PAINTSTRUCT ps;
      char text[ 256 ];
      RECT rct;
      HDC hDC = BeginPaint( hWnd, &ps );
      HGDIOBJ hOldFont;
     
      GetWindowText( hWnd, text, 255 );
      GetClientRect( hWnd, &rct );
      SetBkMode( hDC, TRANSPARENT );
      SelectObject( hDC, GetStockObject( DEFAULT_GUI_FONT ) );

      SendMessage( GetParent( hWnd ), WM_CTLCOLORSTATIC, ( WPARAM ) hDC, ( LPARAM ) hWnd );
      hOldFont = SelectObject( hDC, ( HGDIOBJ ) SendMessage( hWnd, WM_GETFONT, 0, 0 ) );
     
      if( ( GetWindowLong( hWnd, GWL_STYLE ) & SS_BLACKFRAME ) ==   SS_BLACKFRAME )
      {
         RECT rct;
         
         GetClientRect( hWnd, &rct );      
         WindowBoxBlack( hDC, &rct );
      }         
     
      else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_CENTER   )
         DrawText( hDC, text, lstrlen( text ), &rct, DT_CENTER ); // | DT_WORDBREAK );
         
      else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_RIGHT   )   
         DrawText( hDC, text, lstrlen( text ), &rct, DT_RIGHT ); // | DT_WORDBREAK );
         
      else   
         DrawText( hDC, text, lstrlen( text ), &rct, DT_LEFT ); // | DT_WORDBREAK );
     
      SelectObject( hDC, hOldFont );
     
      EndPaint( hWnd, &ps );
     
      return 0;
   }   
   else
      return CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
}

CLIPPER FIXSAYS( PARAMS )
{
   HWND hDlg = ( HWND ) _parnl( 1 );
   HWND hCtrl = GetWindow( hDlg, GW_CHILD );   
   char className[ 64 ]; 
   WNDPROC pLabelProc = NULL;

   while( hCtrl != NULL )
   {
      GetClassName( hCtrl, className, sizeof( className ) );

      if( ! lstrcmp( "Static", className ) && ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ICON ) == SS_ICON ) )
      {
            if( GetWindowLong( hCtrl, GWL_WNDPROC ) != ( LONG ) LabelProc )
            {   
               pLabelProc = ( WNDPROC ) SetWindowLong( hCtrl, GWL_WNDPROC,
                                                       ( LONG ) LabelProc );
               SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
            }   
      }
      hCtrl = GetWindow( hCtrl, GW_HWNDNEXT );
   }
}
regards, saludos

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

Postby byte-one » Mon Nov 24, 2008 2:51 pm

Antonio, when I compile this code, I will receive this error:

Type mismatch in parameter "lpPrevWndFunc" (wanted "long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)" in function LabelProc

Any headerfiles missing? I use winten.h , windows.h and clipapi.h
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby byte-one » Tue Nov 25, 2008 3:35 pm

Antonio, when I change the declaration in windef.h from
typedef int (FAR WINAPI *FARPROC)()
to
typedef long (FAR WINAPI *FARPROC)()
then it is ok.
I renamed also CLIPPER FIXSAYS( PARAM ) to HARBOUR HB_FUN_FIXSAYS()! With old syntax it is not functioning!?

I add to the code in all three calls from DrawText() the DT_WORDBREAK as this is the normal situation when no transparent is declared.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 87 guests