FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Show a text on Tab class
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Show a text on Tab class
Posted: Tue Sep 23, 2014 10:58 AM
I wish show a text into tab but I have some problem when I have many tabs

I made this test to try




1. the say is not transparent
2. if I have many tabs the text is not where I wish it must be

Code (fw): Select all Collapse
FUNCTION Tab_ShowText( oTab,text)
   Local oPSay2
   Local nSpace := 0
   Local numtab:= 0

   IF  Len( oTab:aPrompts ) > 5
      numtab:= 3
   ELSE
       numtab:=  Len( oTab:aPrompts )
    ENDIF

    FOR n = 1 to numtab
       nSpace := nSpace + GetTextWidth( 0, StrTran( oTab:aPrompts[ n ], "&", "" ), ;
       /*oTab:hFont*/ )  ;
      /* IF( Empty( oTab:ahBitmaps[ n ] ), 0, 18 ) */
    NEXT

    @ 0, nSpace SAY oPSay2 PROMPT text  OF oApp():oTab   COLOR CLR_RED   TRANSPARENT

RETURN (NIL)


to call the function :

@ 2,10 TABS oTab ;
OPTION .....


ACTIVATE DIALOG oDlg ;
ON INIT Tab_scritta( oTab,"text")




Any help please ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Show a text on Tab class
Posted: Wed Sep 24, 2014 10:43 AM

Silvio,

Don't create a SAY control. Directly paint the text using the bPainted codeblock of the tab control

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Show a text on Tab class
Posted: Wed Sep 24, 2014 12:44 PM

thanks Antonio
Can you say how ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Show a text on Tab class
Posted: Wed Sep 24, 2014 03:35 PM
Silvio,

I have not tested it. You can fine tune it:

Code (fw): Select all Collapse
oTabs:bPainted = { | hDC | Tab_ShowText( hDC, oTabs, text ) }

...

FUNCTION Tab_ShowText( hDC, oTab,text)

   Local oPSay2
   Local nSpace := 0
   Local numtab:= 0

   IF  Len( oTab:aPrompts ) > 5
      numtab:= 3
   ELSE
       numtab:=  Len( oTab:aPrompts )
    ENDIF

    FOR n = 1 to numtab
       nSpace := nSpace + GetTextWidth( 0, StrTran( oTab:aPrompts[ n ], "&", "" ), ;
       /*oTab:hFont*/ )  ;
      /* IF( Empty( oTab:ahBitmaps[ n ] ), 0, 18 ) */
    NEXT

    SetTextColor( hDC, CLR_RED )
    SetBkMode ( hDC, 1 ) // transparent
    DrawText( hDC, text, { 0, nSpace, oTab:nHeight, nSpace + 100 }, DT_LEFT )

RETURN (NIL)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Show a text on Tab class
Posted: Wed Sep 24, 2014 04:32 PM

sorry but I not see any text into tab control and say to me it not found DT_LEFT

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion