Hi,
There is a TButtonBmp button. I select a file via cGetFile and get the icon associated with the type of this file
nam:=cGetFile()
aa:=0
img:=BmpFromIcon(EXTRACTASSICON( 0, nam, @aa))
Now I need to insert this icon into the button. How can I do that ?
Inserting an icon on a button
Re: Inserting an icon on a button
Buttonaction of oBtn2 changes the bitmap < setup1.bmp > of oBtn3 to < setup2.bmp >
@ 50, 180 BTNBMP oBtn2 ;
OF oDlg FLAT ;
SIZE 64, 64 ;
PIXEL ;
RESOURCE 0xE10B ;
ACTION ( oBtn3:LoadBitmap( 'SETUP2.bmp' ), oBtn3:Refresh() ) ; // update of oBtn3
COLOR CLR_WHITE, 12088150
ACTION MsgAlert( "Test" )
regards
Uwe
@ 50, 180 BTNBMP oBtn2 ;
OF oDlg FLAT ;
SIZE 64, 64 ;
PIXEL ;
RESOURCE 0xE10B ;
ACTION ( oBtn3:LoadBitmap( 'SETUP2.bmp' ), oBtn3:Refresh() ) ; // update of oBtn3
COLOR CLR_WHITE, 12088150
@ 50 , 280 BUTTONBMP oBtn3 BITMAP 'SETUP1.bmp' SIZE 64, 64 PIXEL OF oDlg ;There is a TButtonBmp button. I select a file via cGetFile and get the icon associated with the type of this file
Now I need to insert this icon into the button. How can I do that ?
ACTION MsgAlert( "Test" )
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Inserting an icon on a button
I didn't understand - BmpFromIcon(EXTRACTASSICON returns a bimap handle. I can't use :LoadBitmap method to enter handle
Re: Inserting an icon on a button
Try with
Code: Select all
@ 50, 180 BTNBMP oBtn2 ;
OF oDlg FLAT ;
SIZE 64, 64 ;
PIXEL ;
RESOURCE 0xE10B ;
ACTION ( nam:=cGetFile(), oBtn3:LoadBitmap( nam ), oBtn3:Refresh() ) ; // update of oBtn3
COLOR CLR_WHITE, 12088150
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: Inserting an icon on a button
Thanks Cristobal, everything works !
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Inserting an icon on a button
We can use any filename as bitmap file. FWH will extract the icon and display it as bitmap of the button.
It is not necessary to write this code
in the application program.
Both BUTTONBMP and BTNBMP automatically does this job for us, without writing this code.
Code: Select all
#include "fivewin.ch"
function Main()
local oDlg, oFont, aSave
local aFile := { "c:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRD32.Exe", ;
"c:\Windows\System32\notepad.exe", ;
"c:\fwh\samples\pdfharu1H.pdf", ;
"c:\fwh\manual\fwcmd.chm" }
aSave := SetDefaultIconSize()
SetDefaultIconSize( 64, 64 )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-20
DEFINE DIALOG oDlg SIZE 400,500 PIXEL TRUEPIXEL FONT oFont
@ 40,40 BUTTONBMP PROMPT "AcrobatReader.Exe" BITMAP aFile[ 1 ] ;
SIZE 300,80 PIXEL OF oDlg TEXTRIGHT
@ 140,40 BUTTONBMP PROMPT "NotePad.Exe" BITMAP aFile[ 2 ] ;
SIZE 300,80 PIXEL OF oDlg TEXTRIGHT
@ 240,40 BUTTONBMP PROMPT "PdfHaru1.pdf" BITMAP aFile[ 3 ] ;
SIZE 300,80 PIXEL OF oDlg TEXTRIGHT
@ 340,40 BUTTONBMP PROMPT "fwcmd.chm" BITMAP aFile[ 4 ] ;
SIZE 300,80 PIXEL OF oDlg TEXTRIGHT
SetDefaultIconSize( aSave[ 1 ], aSave[ 2 ] )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
It is not necessary to write this code
Code: Select all
img:=BmpFromIcon(EXTRACTASSICON( 0, nam, @aa))
Both BUTTONBMP and BTNBMP automatically does this job for us, without writing this code.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India