Page 1 of 2
Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Mon Jul 18, 2016 11:47 am
by ukoenig
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: Select all
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
Re: A problem TFOLDEREX tab-images from resource ?
Posted: Tue Jul 19, 2016 9:38 am
by Antonio Linares
Uwe,
Please try this change in function fnAddBitmap() (source\function\etc.prg)
Code: Select all
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: Select all
function fnAddBitmap( uBmp )
local aPalBmp := WndReadPalBmpEx( uBmp )
DeleteObject( aPalBmp[ 2 ] )
return aPalBmp[ 1 ]
I appreciate if you test both, thanks
Re: A problem TFOLDEREX tab-images from resource ?
Posted: Tue Jul 19, 2016 11:05 am
by ukoenig
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
Re: Painting Tab-images from resource TFOLDEREX
Posted: Tue Jul 19, 2016 4:56 pm
by cnavarro
Please, try with
Code: Select all
function fnAddBitmap( uBmp )
local aPalBmp := WndReadPalBmpEx( nil, uBmp, , ) // Modify line and try
DeleteObject( aPalBmp[ 2 ] )
return aPalBmp[ 1 ]
Or, you try
Code: Select all
function fnAddBitmap( uBmp )
//local hBitMap := WndReadPalBmpEx( nil , uBmp, , )[ 1 ] // Modify line and try
return WndReadPalBmpEx( nil , uBmp, , )[ 1 ] //hBitMap
Re: Painting Tab-images from resource TFOLDEREX
Posted: Tue Jul 19, 2016 5:22 pm
by ukoenig
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
Re: Painting Tab-images from resource RC and DLL TFOLDEREX
Posted: Tue Jul 19, 2016 7:48 pm
by cnavarro
Uwe
function WndReadPalBmpEx( oWnd, uBmp, aReSize, lGdipImage )
// call this function with 1st param as NIL or hDC
// if lGdiPlus, ret value is Gdi+ Image *
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Jul 20, 2016 10:05 am
by ukoenig
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
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Jul 20, 2016 10:15 am
by cnavarro
Uwe, thanks
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Sat Sep 10, 2016 11:45 am
by gautxori
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: Select all
#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=0BzTM7 ... nYydFhsd2M
Adjunto las imágenes
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 5:41 pm
by gautxori
Alguna idea para hacer aparecer un bitmap en las pestañas de un folderex¿?
Gracias
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 6:39 pm
by Antonio Linares
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" ;
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 6:58 pm
by amgomezdiez
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
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Tue Sep 13, 2016 8:39 pm
by Antonio Linares
Prueba a usar nombres de los bitmaps que sean mas diferentes entre si:
"BTNUNO", "BTNDOS", "BTNTRES"
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Sep 14, 2016 1:58 pm
by gautxori
Tampoco, probado con las posibles combinaciones de etc.prg
Una pena, con DLL no funciona . desisto
Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)
Posted: Wed Sep 14, 2016 3:52 pm
by Antonio Linares
Tu ejemplo ha funcionado aqui bien a la primera, al construirlo con buildh.bat