Page 1 of 1

Multiline in TBtnBmp and color in TreeView

Posted: Fri Mar 30, 2007 11:53 am
by Maurilio Viana
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

Re: Multiline in TBtnBmp and color in TreeView

Posted: Fri Mar 30, 2007 6:02 pm
by Maurilio Viana
Problem of TreeView is solved (I found solution in other topic) but multiline in TBtnBmp continues...

Regards,
Maurilio

Posted: Mon Apr 02, 2007 4:02 pm
by Maurizio
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

Posted: Mon Apr 02, 2007 4:16 pm
by Maurilio Viana
Thanks, Maurizio!!!

I'll try it!

Best regards,
Maurilio

Posted: Tue Apr 03, 2007 11:57 am
by Maurilio Viana
I tryed but text are not displayed in correct position :-(

Regards
Maurilio

Posted: Tue Apr 03, 2007 12:39 pm
by Maurizio
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]

Posted: Tue Apr 03, 2007 4:13 pm
by Maurilio Viana
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