Page 1 of 1

add a symbol

PostPosted: Mon Jan 15, 2018 3:50 pm
by Silvio.Falconi
I wish insert a symbol on a urlink object near to caption and I wuish insert a Arrow down
How I can make ?

oBarOpenWithlist:= TUrlLink():New( 200, 20, oAllegati, .T., .F., oFontOpenlist, "Apri con...", "Apri con..." )

Re: add a symbol

PostPosted: Mon Jan 15, 2018 5:34 pm
by cnavarro
Look in

METHOD AddLink( cPrompt, bAction, cBitmap, oFnt, nClrT, nClrP, nClrO ) CLASS TTaskPanel


from TExplBar.prg

Re: add a symbol

PostPosted: Mon Jan 15, 2018 5:43 pm
by Silvio.Falconi
Please ?

on TUrlLink I cannot see bitmap I see only Hbmp as data and then a method Destroy() at the end

Re: add a symbol

PostPosted: Mon Jan 15, 2018 6:10 pm
by cnavarro
Add your code after define you urllink

Code: Select all  Expand view

.../...
   if File( cBitmap )
      oUrlLink:hBmp = ReadBitmap( 0, cBitmap )
   else
      oUrlLink:hBmp = LoadBitmap( GetResources(), cBitmap )
   endif

.../...
 

Re: add a symbol

PostPosted: Tue Jan 16, 2018 9:21 am
by Silvio.Falconi
I put it but not run I not see any bitmap

cBitmap:= "APRICON"

oBarOpenWithlist:= TUrlLink():New( 200, 20, oAllegati, .T., .F., oFontOpenlist, "Apri con...", "Apri con..." )


if File( cBitmap )
oBarOpenWithlist:hBmp = ReadBitmap( 0, cBitmap )
else
oBarOpenWithlist:hBmp = LoadBitmap( GetResources(), cBitmap )
endif

Re: add a symbol

PostPosted: Tue Jan 16, 2018 2:25 pm
by cnavarro
What is it cBitmap:= "APRICON"

File or Resource?

Re: add a symbol

PostPosted: Tue Jan 16, 2018 6:19 pm
by Silvio.Falconi
resource and I tried also with .\bitmaps\apricon.bmp

Re: add a symbol

PostPosted: Tue Jan 16, 2018 6:27 pm
by cnavarro
this code run OK in
Code: Select all  Expand view

METHOD AddLink( cPrompt, bAction, cBitmap, oFnt, nClrT, nClrP, nClrO ) CLASS TTaskPanel
 


Put a little sample for test

Re: add a symbol

PostPosted: Fri Jan 19, 2018 9:09 pm
by Silvio.Falconi
Function Test()
Local oAllegati,
Local nBottom := 33
Local nRight := 115
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H

LOcal oFontOpenlist:= TFont():New( "Tahoma", 0, -12,,.F. )
DEFINE DIALOG oAllegati ;
TITLE "test" ;
SIZE nWidth, nHeight TRANSPARENT PIXEL

cBitmap:= "APRICON" // resource or bmp

oBarOpenWithlist:= TUrlLink():New( 200, 20, oAllegati, .T., .F., oFontOpenlist, "Apri con...", "Apri con..." )


if File( cBitmap )
oBarOpenWithlist:hBmp = ReadBitmap( 0, cBitmap )
else
oBarOpenWithlist:hBmp = LoadBitmap( GetResources(), cBitmap )
endif


ACTIVATE DIALOG oAllegati CENTERED
return nil

Re: add a symbol

PostPosted: Fri Jan 19, 2018 10:33 pm
by cnavarro
You have to paint the image

Code: Select all  Expand view

//----------------------------------------------------------------------------//

Function Test()
   
   Local oDlg
   Local nBottom := 33
   Local nRight := 115
   Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   local oItem
   local oFontOpen := TFont():New( "Tahoma", 0, -18,,.F. )
   
   DEFINE DIALOG oDlg TITLE "test" SIZE nWidth, nHeight PIXEL //TRANSPARENT

   oItem := TUrlLink():New( 60, 100, oDlg, .T., .F., oFontOpen, "Prueba de UrlLink con Bitmap...", "Prueba de UrlLink con Bitmap..." )

   ACTIVATE DIALOG oDlg CENTERED ; //      ON INIT  ( oItem := HazLink( oDlg ) ) ;
      ON PAINT ( PaintMyBmp( oDlg, oItem ) ) ;
      VALID    ( DeleteObject( oItem:hBmp ), .T. )
return nil

//----------------------------------------------------------------------------//

Function HazLink( oDlg )

   local oFontOpen := TFont():New( "Tahoma", 0, -18,,.F. )
   local oItem

   oItem := TUrlLink():New( 60, 100, oDlg, .T., .F., oFontOpen, "Prueba de UrlLin con Bitmap...", "Prueba de UrlLin con Bitmap..." )

Return oItem

//----------------------------------------------------------------------------//

Function PaintMyBmp( oDlg, oItem )

   local cBitmap
   cBitmap:= "d:\fwh\fwhteam\bitmaps\16x16\about.bmp"
   
   if File( cBitmap )
      oItem:hBmp := ReadBitmap( 0, cBitmap )
   else
      oItem:hBmp := LoadBitmap( GetResources(), cBitmap )
   endif
   if !Empty( oItem:hBmp )
      DrawTransparent( oDlg:hDC, oItem:hBmp, oItem:nTop + 2, ;
                             oItem:nLeft - nBmpWidth( oItem:hBmp ) - 6 )
   endif
Return nil

//----------------------------------------------------------------------------//

 

Re: add a symbol

PostPosted: Tue Jan 23, 2018 8:17 pm
by Silvio.Falconi
run ok
but the bitmap is before and then I cannot make on paint because it refresh all dialog allways when I resize the dialog
I must search another solution