Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby ukoenig » 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

Image
Code: Select all  Expand view

 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

Image

regards
Uwe :?:
Last edited by ukoenig on Tue Jul 19, 2016 8:00 pm, edited 6 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem TFOLDEREX tab-images from resource ?

Postby Antonio Linares » Tue Jul 19, 2016 9:38 am

Uwe,

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

Code: Select all  Expand view
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  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41286
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: A problem TFOLDEREX tab-images from resource ?

Postby ukoenig » 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 :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Painting Tab-images from resource TFOLDEREX

Postby cnavarro » Tue Jul 19, 2016 4:56 pm

Please, try with

Code: Select all  Expand view


function fnAddBitmap( uBmp )

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

return aPalBmp[ 1 ]
 


Or, you try

Code: Select all  Expand view

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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Painting Tab-images from resource TFOLDEREX

Postby ukoenig » Tue Jul 19, 2016 5: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 :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Painting Tab-images from resource RC and DLL TFOLDEREX

Postby cnavarro » Tue Jul 19, 2016 7: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 *



:D :D :D
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby ukoenig » 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

Image

regards
Uwe :D
Last edited by ukoenig on Wed Jul 20, 2016 10:17 am, edited 1 time in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby cnavarro » 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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby gautxori » 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: Select all  Expand view
#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

Image

Image

Image
Un saludo
___________________________________________________
La mente es como un paracaídas, solo funciona si se abre
Harbour 3.2.0dev (r1601050904) , Fivewin 16.04
User avatar
gautxori
 
Posts: 69
Joined: Thu Feb 25, 2010 12:44 pm
Location: Plentzia (Bizkaia)

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby gautxori » Tue Sep 13, 2016 5: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
User avatar
gautxori
 
Posts: 69
Joined: Thu Feb 25, 2010 12:44 pm
Location: Plentzia (Bizkaia)

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

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

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby amgomezdiez » Tue Sep 13, 2016 6: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
amgomezdiez
 
Posts: 3
Joined: Sun Jul 03, 2016 7:56 pm

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

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

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby gautxori » Wed Sep 14, 2016 1: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
User avatar
gautxori
 
Posts: 69
Joined: Thu Feb 25, 2010 12:44 pm
Location: Plentzia (Bizkaia)

Re: Painting Tab-images from res. RC and DLL TFOLDEREX (solved)

Postby Antonio Linares » Wed Sep 14, 2016 3:52 pm

Tu ejemplo ha funcionado aqui bien a la primera, al construirlo con buildh.bat

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41286
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 14 guests