FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Multiline in TBtnBmp and color in TreeView
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Multiline in TBtnBmp and color in TreeView
Posted: Fri Mar 30, 2007 11:53 AM

Hi,

After many changes in my program I could recompile it with FWH 7.1 and xHB.com 2007/January.

Only 2 little things don't work for me:

WhatsNew.txt says that now TBtnBmp accept multiline text. I try define the text "Line 1"+CRLF+"Line 2" but it didn't worked... Displayed text in button is "Line 1 || Line 2" showed in one line (CRLF appears like "||" or any).
I search fwbmp.c and included PalBtnPaint function in my app but I couldn't debbug it. I think it isn't entering in code marked with: #ifdef UNICODE
Then I declared UNICODE (#define UNICODE) but this way I get any warnings and errors when compile.

Another one: background of TreeView changed the color to BtnFace color (was WHITE). The text items is all black color (only display correct color on selected items) and last row of treeview don't display [+] mark and icon correctly.

Antonio, can you help me?

Thanks a lot!
Maurilio

Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Re: Multiline in TBtnBmp and color in TreeView
Posted: Fri Mar 30, 2007 06:02 PM

Problem of TreeView is solved (I found solution in other topic) but multiline in TBtnBmp continues...

Regards,
Maurilio

Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Multiline in TBtnBmp and color in TreeView
Posted: Mon Apr 02, 2007 04:02 PM

This is a bad workaround

In the method PAint() after PalBtnPaint(

 PalBtnPaint( ::hWnd, ::hBitmap1, ::hPalette1, ::hBitmap2, ::hPalette2,;
            ::hBitmap3, ::hPalette3, ::lPressed, ::lAdjust, ::lBorder,;
            ::oPopup != nil, ::nClrPane,  ::cCaption, ::nLayout,;
            If( ::oFont != nil, ::oFont:hFont, 0 ), ::nClrText, ::hDC )



    //----- My_modi
IF empty(::cBmpFile1)
   ::cCaption := cOldCAption
   nLenText := GetTextWidth( hDC, ::cCaption ,  If( ::oFont != nil, ::oFont:hFont, 0 )  )
   IF nLenText > ::nWidth()
          hDC  = ::hDC
      SetBkMode( hDc, 1 )
          SetTextColor( hDC,::nClrText  )
          SelectObject( hDC, If( ::oFont != nil, ::oFont:hFont, 0 ) )
          nTxtHeight := Max(14, GetTextHeight( ::hWnd )-2)
      FOR nX := 1 TO len(::cCaption)
      IF substr(::cCaption,nX,1) == " "   // or seek for a  CRLF
         TextOut( hDC,nR * nTxtHeight , 1 , substr(::cCaption,n1,nX-n1) )
         n1 := nX + 1
         nR++
       ENDIF
      NEXT
   ENDIF
ENDIF
//------ End
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Multiline in TBtnBmp and color in TreeView
Posted: Mon Apr 02, 2007 04:16 PM

Thanks, Maurizio!!!

I'll try it!

Best regards,
Maurilio

Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Multiline in TBtnBmp and color in TreeView
Posted: Tue Apr 03, 2007 11:57 AM

I tryed but text are not displayed in correct position :-(

Regards
Maurilio

Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Multiline in TBtnBmp and color in TreeView
Posted: Tue Apr 03, 2007 12:39 PM
Hello Maurilio
I use it

@ 1 ,2 BTNBMP oBtn OF oDlg SIZE 40 ,40
oBtn:cCaption := "Test in button"

[img]http://img142.imageshack.us/img142/5164/immaginemd1.jpg" alt="" loading="lazy">[/img]
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Multiline in TBtnBmp and color in TreeView
Posted: Tue Apr 03, 2007 04:13 PM

Maurizio,

I tryed to place the text centered in bottom of button. But without success (yet). I'll continue trying. Or wait for Antonio because whatsnew.txt of near FWH says that multiline was added in tbtnbmp class. I have recent build (2007/jan) but it don't work for me...

Thanks a lot!
Maurilio

Continue the discussion