FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SAY ... TRANSPARENT are not wordwrapping
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
SAY ... TRANSPARENT are not wordwrapping
Posted: Tue Nov 11, 2008 04:32 PM
On a dialog TRANSPARENT a long text from say are not wrapped in next line.

This is with DIALOG......TRANSPARENT



and this without TRANSPARENT



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.
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
SAY ... TRANSPARENT are not wordwrapping
Posted: Thu Nov 20, 2008 02:55 PM

Antonio, any suggestion?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
SAY ... TRANSPARENT are not wordwrapping
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
SAY ... TRANSPARENT are not wordwrapping
Posted: Mon Nov 24, 2008 01:41 PM
Günther,

In FixSays() we use this code:
      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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
SAY ... TRANSPARENT are not wordwrapping
Posted: Mon Nov 24, 2008 01:44 PM
Günther,

Here you have the source code for FixSays() just in case that you want to do some tests with it:
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
SAY ... TRANSPARENT are not wordwrapping
Posted: Mon Nov 24, 2008 02: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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
SAY ... TRANSPARENT are not wordwrapping
Posted: Tue Nov 25, 2008 03: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

Continue the discussion