Show a text on Tab class

Show a text on Tab class

Postby Silvio.Falconi » 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

Image


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

Code: Select all  Expand view

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:oBold: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show a text on Tab class

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Show a text on Tab class

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show a text on Tab class

Postby Antonio Linares » Wed Sep 24, 2014 3:35 pm

Silvio,

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

Code: Select all  Expand view

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:oBold: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Show a text on Tab class

Postby Silvio.Falconi » Wed Sep 24, 2014 4: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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