FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Mon Jul 18, 2016 11:47 AM
I noticed,

in TFOLDEREX loading Tab images from RESOURCE ( DLL ) doesn't work
Loading the image from FILE it is Ok.
Using images ( 32 bit alphablended ) from DLL on all other controls like buttons is working fine.

My tests

The FISHES.dll and books.bmp for testing
Download
http://www.pflegeplus.com/DOWNLOADS/Testdll1.zip


Code (fw): Select all Collapse
 SET RESOURCES TO c_path + "FISHES.dll"

aBitmaps1 := { "BOOKS",;    // from DLL
               "BOOKS",;
               "BOOKS",;
               "BOOKS",;
               "BOOKS" }

aBitmaps2 := { c_path + "Books.bmp",;   // from code
               c_path + "Books.bmp",;
               c_path + "Books.bmp",;
               c_path + "Books.bmp",;
               c_path + "Books.bmp" }

DEFINE DIALOG oDlg1 TITLE "Test folder from CODE" SIZE 550, 560 PIXEL OF oWnd BRUSH oBrush0

@ 15, 10 FOLDEREX SIZE 260, 180 oFld1 PIXEL ROUND 5 UPDATE ;
PROMPT  "Page &1", "Page &2", "Page &3", "Page &4", "&EXIT" OF oDlg1 ;
BITMAPS aBitmaps2 ; // from code OK
...
...
// in folderpage 1 ( display books from DLL ) :

@ 100, 220 BITMAP oBmp2 RESOURCE "BOOKS"  OF oFld1:aDialogs[1] ;  
SIZE 24, 24 PIXEL  NOBORDER
oBmp2:cTooltip := "Image"
oBmp2:lTransparent := .T.


missing tab-images using < aBitmaps1> from resource

@ 15, 10 FOLDEREX SIZE 260, 180 oFld1 PIXEL ROUND 5 UPDATE ;
PROMPT "Page &1", "Page &2", "Page &3", "Page &4", "&EXIT" OF oDlg1 ;
BITMAPS aBitmaps1 ; // from DLL



regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: A problem TFOLDEREX tab-images from resource ?
Posted: Tue Jul 19, 2016 09:38 AM
Uwe,

Please try this change in function fnAddBitmap() (source\function\etc.prg)

Code (fw): Select all Collapse
function fnAddBitmap( uBmp, hInstance )

   local hBmp := 0
   
   DEFAULT hInstance := GetResources()

   if ValType( uBmp ) == 'N' .and. uBmp != 0
      if IsGdiObject( uBmp )
         hBmp                     := uBmp
      else
         hBmp := LoadBitmap( hInstance, uBmp )
      endif
   elseif ValType( uBmp ) == 'C'
      if Lower( Right( uBmp, 4 ) ) == '.bmp'
         if file( uBmp )
            hBmp := ReadBitmap( 0, uBmp )
         endif
      elseif !( '.' $ uBmp )
         hBmp := LoadBitmap( hInstance, uBmp )
      endif
   endif

return hBmp


This is another solution:
Code (fw): Select all Collapse
function fnAddBitmap( uBmp )

   local aPalBmp := WndReadPalBmpEx( uBmp )
   
   DeleteObject( aPalBmp[ 2 ] )

return aPalBmp[ 1 ]


I appreciate if you test both, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A problem TFOLDEREX tab-images from resource ?
Posted: Tue Jul 19, 2016 11:05 AM
Antonio,

thank You very much.
Your first solution is working perfectly, painting tab-images from FILE and DLL
The second solution doesn't display the tab-images neither from CODE or DLL
( my first sample from CODE + DLL is completed now using Your changes
I will carry on working on the RESOURCE + DLL-section that is partly finished )

From CODE / DLL painting the tab-images
From RESOURCE / DLL works as well

On Top of MAIN

hSave := GetResources() // linked RC-file
SET RESOURCES TO c_path + "SYSTEM.dll" // DLL with 32 bit alphablended BMP's

...
...
aBitmaps1 := { "BOOKS",; // from DLL
"BOOKS",;
"BOOKS",;
"BOOKS",;
"BOOKS" }

DEFINE DIALOG oDlg1 TITLE "Test folder from CODE" SIZE 550, 560 PIXEL OF oWnd BRUSH oBrush0

@ 10, 10 FOLDEREX SIZE 260, 190 oFld1 PIXEL ROUND 5 UPDATE ;
PROMPT "Page &1", "Page &2", "Page &3", "Page &4", "&EXIT" OF oDlg1 ;
BITMAPS aBitmaps1 ; // from DLL
...
...


From RESOURCE painting the tab-images, button-images ...

....
// selecting RC-file defined with < hSave := GetResources() >
SetResources( hSave )

DEFINE DIALOG oDlg2 RESOURCE "DPainter" BRUSH oBrush0 PIXEL ;
FONT oFont1 TITLE "Test folder from RESOURCES" OF oWnd

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

REDEFINE FOLDEREX oFld2 ID 110 PROMPT "Page &1", "Page &2", "Page &3", "Page &4", "&EXIT" ;
BITMAPS aBitmaps1 ;
DIALOGS "Child1", "Child2", "Child3", "Child4", "Child5" ;
...
...
// change to DLL to load the images
SET RESOURCES TO c_path + "SYSTEM.dll" // select DLL

oBtn[1]:SetFile( "EXIT" ) // set button-image

oBitmap:SetBMP( "IMAGE1" ) // set Image
oBitmap:Refresh()

aBitmaps1 := { "BOOKS",; // define folder-tab-images
"BOOKS",;
"BOOKS",;
"BOOKS",;
"BOOKS" }
// load images from DLL repainting the tabs after folder-painting from RC !!!
oFld2:LoadBitmaps( aBitmaps1 )
oFld2:Refresh() // repaints the folder tab-images

SetResources( hSave ) // Back to RC
...
...


regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Painting Tab-images from resource TFOLDEREX
Posted: Tue Jul 19, 2016 04:56 PM
Please, try with

Code (fw): Select all Collapse
function fnAddBitmap( uBmp )

   local aPalBmp := WndReadPalBmpEx(  nil, uBmp, , )   // Modify line and try
   
   DeleteObject( aPalBmp[ 2 ] )

return aPalBmp[ 1 ]


Or, you try

Code (fw): Select all Collapse
function fnAddBitmap( uBmp )

   //local hBitMap := WndReadPalBmpEx( nil , uBmp, , )[ 1 ]   // Modify line and try
   
return  WndReadPalBmpEx( nil , uBmp, , )[ 1 ]   //hBitMap
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Painting Tab-images from resource TFOLDEREX
Posted: Tue Jul 19, 2016 05:22 PM
Cristobal,
thank You very much
both of Your solutions are working tested from CODE + DLL and RC + DLL

function fnAddBitmap( uBmp )
local aPalBmp := WndReadPalBmpEx( nil, uBmp, , )
DeleteObject( aPalBmp[ 2 ] )
return aPalBmp[ 1 ]


function fnAddBitmap( uBmp )
return WndReadPalBmpEx( nil , uBmp, , )[ 1 ] //hBitMap


regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Painting Tab-images from resource RC and DLL TFOLDEREX
Posted: Tue Jul 19, 2016 07:48 PM
Uwe



function WndReadPalBmpEx( oWnd, uBmp, aReSize, lGdipImage )
// call this function with 1st param as NIL or hDC
// if lGdiPlus, ret value is Gdi+ Image *



:-) :-) :-)
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Jul 20, 2016 10:05 AM
Cristobal,

the download ( 3.2 MB )
everything You need is included, as well RESEDIT
The section testing from resource RC / DLL is still under construction
The section from code loading images from a DLL is finished

Last minute changes : added a buttonbar-test
added some more space to dialog and folder, to include more ( maybe needed ) tests

http://www.pflegeplus.com/DOWNLOADS/Dlltest1.zip



regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Jul 20, 2016 10:15 AM

Uwe, thanks

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 69
Joined: Thu Feb 25, 2010 12:44 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Sat Sep 10, 2016 11:45 AM
Buenos días,

He hecho la prueba con los tres cambios en fwh\source\function\etc.prg y no consigo que salgan las imágenes en las pestañas.
el recurso pruebatab.dll tiene tres bitmaps y tres diálogos

el código del programa es este

Code (fw): Select all Collapse
#INCLUDE "fivewin.ch"

static oWin , oDlg , oFld, aBitmaps1
//----------------------------------------------------------------------//
function main()

SET RESOURCES TO "pruebatab.dll"
aBitmaps1 := { "BOTON1", "BOTON2",  "BOTON3" } ; //From DLL

DEFINE DIALOG oDlg OF oWin NAME "MAIN"

REDEFINE FOLDEREX oFld ID 4001 OF oDlg ;
    PROMPT " F1 "," F2 "," F3 ";
    DIALOGS "DIALOGO1" , "DIALOGO2" , "DIALOGO3";
  BITMAPS aBitmaps1 ; 

ACTIVATE DIALOG oDlg
return NIL


Adjunto programa y dll, se puede ccompilar y ejecutar desde fwh/samples

https://drive.google.com/open?id=0BzTM70TbIJZhekViRnYydFhsd2M

Adjunto las imágenes





Un saludo

___________________________________________________

La mente es como un paracaídas, solo funciona si se abre

Harbour 3.2.0dev (r1601050904) , Fivewin 16.04
Posts: 69
Joined: Thu Feb 25, 2010 12:44 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 05:41 PM

Alguna idea para hacer aparecer un bitmap en las pestañas de un folderex¿?

Gracias

Un saludo

___________________________________________________

La mente es como un paracaídas, solo funciona si se abre

Harbour 3.2.0dev (r1601050904) , Fivewin 16.04
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 06:39 PM

Estas usando un array en vez de una lista de nombres.

Prueba asi:

REDEFINE FOLDEREX oFld ID 4001 OF oDlg ;
PROMPT " F1 "," F2 "," F3 ";
DIALOGS "DIALOGO1" , "DIALOGO2" , "DIALOGO3";
BITMAPS "BOTON1", "BOTON2", "BOTON3" ;

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3
Joined: Sun Jul 03, 2016 07:56 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 06:58 PM
Antonio Linares wrote:Estas usando un array en vez de una lista de nombres.

Prueba asi:

REDEFINE FOLDEREX oFld ID 4001 OF oDlg ;
PROMPT " F1 "," F2 "," F3 ";
DIALOGS "DIALOGO1" , "DIALOGO2" , "DIALOGO3";
BITMAPS "BOTON1", "BOTON2", "BOTON3" ;

Antonio. Eso fue lo primero que probé y tampoco


Enviado desde mi C6903 mediante Tapatalk
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 08:39 PM

Prueba a usar nombres de los bitmaps que sean mas diferentes entre si:

"BTNUNO", "BTNDOS", "BTNTRES"

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 69
Joined: Thu Feb 25, 2010 12:44 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Sep 14, 2016 01:58 PM

Tampoco, probado con las posibles combinaciones de etc.prg

Una pena, con DLL no funciona . desisto :(

Un saludo

___________________________________________________

La mente es como un paracaídas, solo funciona si se abre

Harbour 3.2.0dev (r1601050904) , Fivewin 16.04
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Sep 14, 2016 03:52 PM
Tu ejemplo ha funcionado aqui bien a la primera, al construirlo con buildh.bat

regards, saludos

Antonio Linares
www.fivetechsoft.com