Multiline in TBtnBmp and color in TreeView

Multiline in TBtnBmp and color in TreeView

Postby Maurilio Viana » 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
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Re: Multiline in TBtnBmp and color in TreeView

Postby Maurilio Viana » Fri Mar 30, 2007 6:02 pm

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

Regards,
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Maurizio » Mon Apr 02, 2007 4: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
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Maurilio Viana » Mon Apr 02, 2007 4:16 pm

Thanks, Maurizio!!!

I'll try it!

Best regards,
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Maurilio Viana » Tue Apr 03, 2007 11:57 am

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

Regards
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Maurizio » 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][img]http://img142.imageshack.us/img142/5164/immaginemd1.jpg[/img][/img]
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Maurilio Viana » Tue Apr 03, 2007 4: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
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

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