change bitmaps from radio button
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
change bitmaps from radio button
I need to change a small bitmaps from radio button ..How I can make ...is there a test sample ?
I use radio control for the first element and the I use radiomenu for the other element
sample :
@ 8, 11 SAY "&Avviso:" SIZE 45, 7 PIXEL OF oFld4:aDialogs[3] COLOR 0, 14215660
@ 6, 51 RADIO aGet[25] VAR nMessaggioComunicazioni Prompt "No" SIZE 30, 10 PIXEL OF oFld4:aDialogs[3] on change refresh_bitmap_avviso(nMessaggioComunicazioni,oBmp[2])
@ 6, 100 RADIOITEM "&Mail" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 150 RADIOITEM "&Sms" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 190 RADIOITEM "&Telefono" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 22, 342 BITMAP oBmp[2] RESOURCE "XPINFO" PIXEL OF oFld4:aDialogs[3] NOBORDER SIZE 32,32 ADJUST
oBmp[2]:ltransparent:=.t.
........
Function refresh_bitmap_avviso(nMessaggioComunicazioni,oBmp[2])
Do case
case nMessaggioComunicazioni = 1
oBmp[2]:cBitmap:="NOavviso"
case nMessaggioComunicazioni = 2
oBmp[2]:cBitmap:="MailAvviso"
case nMessaggioComunicazioni = 3
oBmp[2]:cBitmap:="avvisoSms"
case nMessaggioComunicazioni = 4
oBmp[2]:cBitmap:="AvvisoTel"
endcase
oBmp[2]:refresh()
return nil
why not run ?
Any Idea ?
I use radio control for the first element and the I use radiomenu for the other element
sample :
@ 8, 11 SAY "&Avviso:" SIZE 45, 7 PIXEL OF oFld4:aDialogs[3] COLOR 0, 14215660
@ 6, 51 RADIO aGet[25] VAR nMessaggioComunicazioni Prompt "No" SIZE 30, 10 PIXEL OF oFld4:aDialogs[3] on change refresh_bitmap_avviso(nMessaggioComunicazioni,oBmp[2])
@ 6, 100 RADIOITEM "&Mail" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 150 RADIOITEM "&Sms" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 190 RADIOITEM "&Telefono" RADIOMENU aGet[25] OF oFld4:aDialogs[3] PIXEL SIZE 30, 10
@ 22, 342 BITMAP oBmp[2] RESOURCE "XPINFO" PIXEL OF oFld4:aDialogs[3] NOBORDER SIZE 32,32 ADJUST
oBmp[2]:ltransparent:=.t.
........
Function refresh_bitmap_avviso(nMessaggioComunicazioni,oBmp[2])
Do case
case nMessaggioComunicazioni = 1
oBmp[2]:cBitmap:="NOavviso"
case nMessaggioComunicazioni = 2
oBmp[2]:cBitmap:="MailAvviso"
case nMessaggioComunicazioni = 3
oBmp[2]:cBitmap:="avvisoSms"
case nMessaggioComunicazioni = 4
oBmp[2]:cBitmap:="AvvisoTel"
endcase
oBmp[2]:refresh()
return nil
why not run ?
Any Idea ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: change bitmaps from radio button
Silvio,
only a quick test ( I still noticed a missing transparency, loading a bmp-resource )
regards
Uwe
only a quick test ( I still noticed a missing transparency, loading a bmp-resource )

Code: Select all | Expand
@ 8, 11 SAY "&Avviso:" SIZE 45, 7 PIXEL OF oFld:aDialogs[3] COLOR 0, 14215660
@ 6, 51 RADIO aGet[25] VAR nMessaggioComunicazioni Prompt "No" SIZE 30, 10 PIXEL OF oFld:aDialogs[3] ;
on change oBmp[2]:Refresh()
@ 6, 100 RADIOITEM "&Mail" RADIOMENU aGet[25] OF oFld:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 150 RADIOITEM "&Sms" RADIOMENU aGet[25] OF oFld:aDialogs[3] PIXEL SIZE 30, 10
@ 6, 190 RADIOITEM "&Telefono" RADIOMENU aGet[25] OF oFld:aDialogs[3] PIXEL SIZE 30, 10
@ 25, 100 BITMAP oBmp[2] RESOURCE NIL PIXEL OF oFld:aDialogs[3] NOBORDER SIZE 32,32 ADJUST
oBmp[2]:ltransparent:=.t.
oBmp[2]:bPainted := { |hDC| IIF( nMessaggioComunicazioni = 1, ;
hBmp := LoadBitmap( GetResources(), "bitmap1" ), NIL ), ;
IIF( nMessaggioComunicazioni = 2, ;
hBmp := LoadBitmap( GetResources(), "bitmap2" ), NIL ), ;
IIF( nMessaggioComunicazioni = 3, ;
hBmp := LoadBitmap( GetResources(), "bitmap3" ), NIL ), ;
IIF( nMessaggioComunicazioni = 4, ;
hBmp := LoadBitmap( GetResources(), "bitmap4" ), NIL ), ;
PalBmpDraw( hDC, 0, 0, hBmp, ,oBmp[2]:nWidth, oBmp[2]:nHeight, , .T., 0 ), ;
DeleteObject( hBmp ) }
/*
PalBmpDraw( <hDC>, <nRow>, <nCol>, <hBitmap>, <hPalette>, <nWidth>, <nHeight>, <nRaster>, <lTransparent>, <nClrPane> ) --> nil
BLACKNESS Turns all output black.
DSTINVERT Inverts the destination bitmap.
MERGECOPY Combines the pattern and the source bitmap by using the Boolean AND operator.
MERGEPAINT Combines the inverted source bitmap with the destination bitmap by using the Boolean OR operator.
NOTSRCCOPY Copies the inverted source bitmap to the destination.
NOTSRCERASE Inverts the result of combining the destination and source bitmaps by using the Boolean OR operator.
PATCOPY Copies the pattern to the destination bitmap.
PATINVERT Combines the destination bitmap with the pattern by using the Boolean XOR operator.
PATPAINT Combines the inverted source bitmap with the pattern by using the Boolean OR operator. Combines the result of this operation with the destination bitmap by using the Boolean OR operator.
SRCAND Combines pixels of the destination and source bitmaps by using the Boolean AND operator.
SRCCOPY Copies the source bitmap to the destination bitmap.
SRCERASE Inverts the destination bitmap and combines the result with the source bitmap by using the Boolean AND operator.
RCINVERT Combines pixels of the destination and source bitmaps by using the Boolean XOR operator.
SRCPAINT Combines pixels of the destination and source bitmaps by using the Boolean OR operator.
WHITENESS Turns all output white.
Values
#define SRCCOPY 13369376 // 0x00CC0020L
#define SRCPAINT 15597702 // 0x00EE0086L
#define SRCAND 8913094 // 0x008800C6L
#define SRCINVERT 6684742 // 0x00660046L
#define SRCERASE 4457256 // 0x00440328L
#define NOTSRCCOPY 3342344 // 0x00330008L
#define NOTSRCERASE 1114278 // 0x001100A6L
#define MERGECOPY 12583114 // 0x00C000CAL
#define MERGEPAINT 12255782 // 0x00BB0226L
#define PATCOPY 15728673 // 0x00F00021L
#define PATPAINT 16452105 // 0x00FB0A09L
#define PATINVERT 5898313 // 0x005A0049L
#define DSTINVERT 5570569 // 0x00550009L
#define BLACKNESS 66 // 0x00000042L
#define WHITENESS 16711778 // 0x00FF0062L
<lTransparent> .t. for transparent bitmap.
<nClrPane> The background color for the transparency effect.
*/
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: change bitmaps from radio button
A extended test with alphablended images from file, testing transparent on folder-brushes
This solution works perfect.
Another solution, setting the image-position related to the radios.
The needed changes :
Best regards
Uwe
This solution works perfect.

Code: Select all | Expand
#Include "Fivewin.ch"
#include "constant.ch"
Function Main()
Local oBmp1, oRadio1, nValue1 := 1
Local oWnd, oDlg, oFld, oBtn1, oBtn2
Local nBottom := 35
Local nRight := 110
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local oFont, oBrush1, oBrush2, oBrush3
LOCAL c_path, c_path1, aBitmaps
c_Path := cFilePath(GetModuleFileName( GetInstance() ) )
c_Path1 := c_path + "Images\"
aBitmaps := { c_path1 + "Preview.Bmp",;
c_path1 + "Preview.bmp",;
c_path1 + "Exit1.bmp" }
DEFINE BRUSH oBrush1 GRADIENT { { 0.50, 16710607, 16759929 }, { 0.50, 16759929, 16710607 } }
DEFINE BRUSH oBrush2 GRADIENT { { 1, 11053311, 16777215 } }
DEFINE BRUSH oBrush3 GRADIENT { { 1, 12647336, 16777215 } }
oFont := TFont():New("Arial",,-18,.F.,.F. ,,,,.F. )
DEFINE WINDOW oWnd TITLE "Foldertest FWH-version => " + FWVERSION BRUSH oBrush1
DEFINE DIALOG oDlg TITLE "Test folder" SIZE nWidth, nHeight PIXEL OF oWnd BRUSH oBrush2
@ 15, 10 FOLDEREX SIZE 280, 160 oFld PIXEL ROUND 5 UPDATE ;
PROMPT "Page &1", "Page &2", "&EXIT" OF oDlg ;
BITMAPS aBitmaps;
ON PAINT TAB PaintTab( Self, nOption );
ON CHANGE ( nSavePage := oFld:nOption, ;
IF( nOption == 3, If( MsgYesNo( "Do you want exit??" ), ;
oWnd:End(), ( ::SetOption( nOldOption ), ::Refresh() ) ), ) ) ;
ON PAINT TEXT( If( nOption == ::nOption .and. nOption == 2, 8388608, 0 ) );
TOP OPTION 1 ALIGN 0, 0, 0
oFld:lTransparent := .T.
oFld:nFolderHeight := 40
oFld:nSeparator := 2
oFld:bClrText := {| o, n | 128 }
oFld:oFont := oFont
oFld:nOption := 1
oFld:aDialogs[ 1 ]:SetBrush( oBrush1 )
oFld:aDialogs[ 2 ]:SetBrush( oBrush2 )
oFld:aDialogs[ 3 ]:SetBrush( oBrush3 )
@ 30, 20 RADIO oRadio1 VAR nValue1 ITEMS "&No" OF oFld:aDialogs[1] SIZE 30, 10 PIXEL ;
ON CHANGE { || oBmp1:Refresh() } UPDATE
@ 30, 70 RADIOITEM "&Mail" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 120 RADIOITEM "&Sms" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 170 RADIOITEM "&Telefono" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 45, 10 PIXEL UPDATE
AEval( oRadio1:aItems, { | oRad | oRad:lTransparent := .T., ;
oRad:SetFont ( oFont ), ;
oRad:nClrText := 255 } )
@ 70, 120 BITMAP oBmp1 FILENAME NIL PIXEL OF oFld:aDialogs[1] NOBORDER SIZE 32,32 ADJUST
oBmp1:ltransparent:=.t.
oBmp1:bPainted := { |hDC| DRAW_IMG( oBmp1, hDC, oFld, c_Path1, nValue1 ) }
ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT ( oDlg:Move( oWnd:nBottom - 150, oWnd:nRight - 420, 600, 420, .f. ) )
ACTIVATE WINDOW oWnd MAXIMIZED
RELEASE BRUSH oBrush1, oBrush2, oBrush3, oFont
RETURN NIL
// ------------------------
FUNCTION PaintTab( o, nOption )
IF nOption == o:nOver .OR. nOption == o:nOption
o:SetAlphaLevel( nOption, 255 )
ELSE
o:SetAlphaLevel( nOption, 50 )
ENDIF
RETURN o:SetFldColors( o, nOption )
// ----------------------------
FUNCTION DRAW_IMG( oImage, hDC, oFld, c_Path1, nPosition )
LOCAL oImg, oImg0, nFactor1, nFactor2, aRect, nWidth, nHeight
aRect := GETCLIENTRECT( oImage:hWnd )
IF nPosition = 1
DEFINE IMAGE oImg FILENAME c_path1 + "No.bmp"
oImg0 := FILoadImg( c_path1 + "No.bmp" )
ENDIF
IF nPosition = 2
DEFINE IMAGE oImg FILENAME c_path1 + "Mail.bmp"
oImg0 := FILoadImg( c_path1 + "Mail.bmp" )
ENDIF
IF nPosition = 3
DEFINE IMAGE oImg FILENAME c_path1 + "Sms.bmp"
oImg0 := FILoadImg( c_path1 + "Sms.bmp" )
ENDIF
IF nPosition = 4
DEFINE IMAGE oImg FILENAME c_path1 + "Phone.bmp"
oImg0 := FILoadImg( c_path1 + "Phone.bmp" )
ENDIF
nFactor1 := aRect[4] / oImg:nWidth
nFactor2 := aRect[3] / oImg:nHeight
cSize := ALLTRIM(STR(oImg:nWidth)) + "x" + ALLTRIM(STR(oImg:nHeight)) + ;
" Resize-Factor : W = " + ALLTRIM(STR(nFactor1)) + " H = " + ALLTRIM(STR(nFactor2))
nWidth := oImg:nWidth
nHeight := oImg:nHeight
lAlpha := HasAlpha( oImg0 )
IF nFactor1 > 1 .and. nFactor2 > 1
IF lAlpha = .T.
ABPaint( hDC, 0, 0, oImg0, 255 )
DeleteObject( oImg0 )
ELSE
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, ,oImg:nWidth, oImg:nHeight )
ENDIF
ENDIF
IF nFactor1 < 1 .and. nFactor2 < 1
IF nFactor1 < nFactor2 // Width-factor > Height-factor
IF lAlpha = .T.
DeleteObject( oImg )
oImg := ResizeImg( oImg0, aRect[4], nHeight * nFactor1 )
ABPaint( hDC, 0, 0, oImg, 255 )
ELSE
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, ,aRect[4], oImg:nHeight * nFactor1 )
ENDIF
ELSE // Width-factor < Height-factor
IF lAlpha = .T.
DeleteObject( oImg )
oImg := ResizeImg( oImg0, oImg:nWidth * nFactor2, aRect[3] )
ABPaint( hDC, 0, 0, oImg, 255 )
ELSE
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, ,oImg:nWidth * nFactor2, aRect[3] )
ENDIF
ENDIF
// MsgAlert( "True 2" )
ENDIF
IF nFactor1 < 1 .and. nFactor2 > 1
IF lAlpha = .T.
DeleteObject( oImg )
oImg := ResizeImg( oImg0, aRect[4], nHeight * nFactor1 )
ABPaint( hDC, 0, 0, oImg, 255 )
ELSE
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, ,aRect[4], oImg:nHeight * nFactor1 )
ENDIF
ENDIF
IF nFactor1 > 1 .and. nFactor2 < 1
IF lAlpha = .T.
DeleteObject( oImg )
oImg := ResizeImg( oImg0, nWidth * nFactor2, aRect[3] )
ABPaint( hDC, 0, 0, oImg, 255 )
ELSE
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, , oImg:nWidth * nFactor2, aRect[3] )
ENDIF
ENDIF
DeleteObject( oImg )
RETURN( cSize )
Another solution, setting the image-position related to the radios.

The needed changes :
Code: Select all | Expand
...
...
@ 30, 20 RADIO oRadio1 VAR nValue1 ITEMS "&No" OF oFld:aDialogs[1] SIZE 30, 10 PIXEL ;
ON CHANGE { || IIF( nValue1 = 1, oBmp1:Move( 130, 50, , , .f. ), NIL ), ;
IIF( nValue1 = 2, oBmp1:Move( 130, 150, , , .f. ), NIL ), ;
IIF( nValue1 = 3, oBmp1:Move( 130, 250, , , .f. ), NIL ), ;
IIF( nValue1 = 4, oBmp1:Move( 130, 380, , , .f. ), NIL ), ;
oFld:aDialogs[ 1 ]:SetBrush( oBrush1 ), ;
oBmp1:Refresh() } UPDATE
@ 30, 70 RADIOITEM "&Mail" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 120 RADIOITEM "&Sms" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 170 RADIOITEM "&Telefono" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 45, 10 PIXEL UPDATE
AEval( oRadio1:aItems, { | oRad | oRad:lTransparent := .T., ;
oRad:SetFont ( oFont ), ;
oRad:nClrText := 255 } )
...
...
ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT ( oDlg:Move( oWnd:nBottom - 150, oWnd:nRight - 420, 600, 420, .f. ), ;
oBmp1:Move( 130, 50, , , .f. ) )
...
...
Best 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.
- FranciscoA
- Posts: 2163
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: change bitmaps from radio button
Mybe this can helps (All from resources)
REDEFINE BITMAP oBmpOpc RESOURCE cBmpOpc ID 4008 OF oDlg
oBmpOpc:lTransparent:=.t.
REDEFINE RADIO oRadio VAR nVar ID 101,102,103,104,105,106,107 OF oDlg ;
ON CHANGE Refresque(nVar,oBmpOpc)
//------------------------
Function Refresque(nVar,oBmpOpc)
if nVar=1
oBmpOpc:SetBmp("Texto")
elseif nVar=2
oBmpOpc:SetBmp("Calculator")
...
...
endif
oBmpOpc:Refresh()
Return nil
REDEFINE BITMAP oBmpOpc RESOURCE cBmpOpc ID 4008 OF oDlg
oBmpOpc:lTransparent:=.t.
REDEFINE RADIO oRadio VAR nVar ID 101,102,103,104,105,106,107 OF oDlg ;
ON CHANGE Refresque(nVar,oBmpOpc)
//------------------------
Function Refresque(nVar,oBmpOpc)
if nVar=1
oBmpOpc:SetBmp("Texto")
elseif nVar=2
oBmpOpc:SetBmp("Calculator")
...
...
endif
oBmpOpc:Refresh()
Return nil
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Re: change bitmaps from radio button
Francisco,
Silvio only wants to load BMP's from a resource like :
DEFINE IMAGE oImg RESOURCE "A_EXIT" // FILENAME c_path1 + "A_EXIT.bmp"
or
oImg := FILoadImg( AllTrim( "A_EXIT.bmp" ), , "A_EXIT" )
The problem : it is impossible, to save a alphablended bmp with Resource-Workshop
I tested with a bmp, changing the transparent-area to black, but PalBmpDraw doesn't
show the bmp transparent.
Original 32 bpp with alpha-channel
reduced to
24 bpp with black background ( transparent area replaced with black )

This bmp can be saved as resource with borland resource-workshop
Maybe somebody can show a working sample from resource using PalBmpDraw ?
Best regards
Uwe
Silvio only wants to load BMP's from a resource like :
DEFINE IMAGE oImg RESOURCE "A_EXIT" // FILENAME c_path1 + "A_EXIT.bmp"
or
oImg := FILoadImg( AllTrim( "A_EXIT.bmp" ), , "A_EXIT" )
The problem : it is impossible, to save a alphablended bmp with Resource-Workshop
I tested with a bmp, changing the transparent-area to black, but PalBmpDraw doesn't
show the bmp transparent.
Original 32 bpp with alpha-channel
reduced to
24 bpp with black background ( transparent area replaced with black )

This bmp can be saved as resource with borland resource-workshop
Maybe somebody can show a working sample from resource using PalBmpDraw ?
Best 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.
- FranciscoA
- Posts: 2163
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: change bitmaps from radio button
The problem : it is impossible, to save a alphablended bmp with Resource-Workshop
I use PellesC

http://www.4shared.com/photo/jcA53BP8ce/Scanning.html
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: change bitmaps from radio button
Uwe,
I tried with this :
@ 22, 342 BITMAP oBmp[2] RESOURCE NIL PIXEL OF OFld4:aDialogs[3] NOBORDER SIZE 32,32 ADJUST
oBmp[2]:ltransparent:=.t.
oBmp[2]:bPainted := { |hDC| IIF( nMessaggioComunicazioni = 1, ;
hBmp := LoadBitmap( GetResources(), "NOAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 2, ;
hBmp := LoadBitmap( GetResources(), "MAILAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 3, ;
hBmp := LoadBitmap( GetResources(), "SMSAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 4, ;
hBmp := LoadBitmap( GetResources(), "PHONEAVVISO" ), NIL ), ;
PalBmpDraw( hDC, 0, 0, hBmp, ,oBmp[2]:nWidth, oBmp[2]:nHeight, , .T., 0 ), ;
DeleteObject( hBmp ) }
When I select the Radio item the bitmap not refresh
If I select another folder tab and then return on that folder tab the bitmpa is changed
Where isi the error?
I tried with this :
@ 22, 342 BITMAP oBmp[2] RESOURCE NIL PIXEL OF OFld4:aDialogs[3] NOBORDER SIZE 32,32 ADJUST
oBmp[2]:ltransparent:=.t.
oBmp[2]:bPainted := { |hDC| IIF( nMessaggioComunicazioni = 1, ;
hBmp := LoadBitmap( GetResources(), "NOAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 2, ;
hBmp := LoadBitmap( GetResources(), "MAILAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 3, ;
hBmp := LoadBitmap( GetResources(), "SMSAVVISO" ), NIL ), ;
IIF( nMessaggioComunicazioni = 4, ;
hBmp := LoadBitmap( GetResources(), "PHONEAVVISO" ), NIL ), ;
PalBmpDraw( hDC, 0, 0, hBmp, ,oBmp[2]:nWidth, oBmp[2]:nHeight, , .T., 0 ), ;
DeleteObject( hBmp ) }
When I select the Radio item the bitmap not refresh
If I select another folder tab and then return on that folder tab the bitmpa is changed
Where isi the error?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: change bitmaps from radio button
Silvio,
I found a short and easy transparent solution that works from resources.
@ 30, 20 RADIO oRadio1 VAR nValue1 ITEMS "&No" OF oFld:aDialogs[1] SIZE 30, 10 PIXEL ;
ON CHANGE { || ;
IIF( nValue1 = 1, oBmp1:LoadImage( "IMAGE1" ), NIL ), ;
IIF( nValue1 = 2, oBmp1:LoadImage( "IMAGE2" ), NIL ), ;
IIF( nValue1 = 3, oBmp1:LoadImage( "IMAGE3" ), NIL ), ;
IIF( nValue1 = 4, oBmp1:LoadImage( "IMAGE4" ), NIL ), ;
oBmp1:Refresh() } UPDATE
@ 30, 70 RADIOITEM "&Mail" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 120 RADIOITEM "&Sms" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 170 RADIOITEM "&Telefono" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 45, 10 PIXEL UPDATE
AEval( oRadio1:aItems, { | oRad | ;
oRad:lTransparent := .T., ;
oRad:SetFont ( oFont ), ;
oRad:nClrText := 255 } )
// define the resource, You want to display at startup !!!
@ 70, 120 BITMAP oBmp1 RESOURCE "IMAGE1" PIXEL OF oFld:aDialogs[1] NOBORDER SIZE 32, 32 ADJUST
oBmp1:ltransparent:=.t.
used Borland resource-workshop
because of NO alpha-channel, a clean borderpainting is needed.

Best regards
Uwe
I found a short and easy transparent solution that works from resources.
@ 30, 20 RADIO oRadio1 VAR nValue1 ITEMS "&No" OF oFld:aDialogs[1] SIZE 30, 10 PIXEL ;
ON CHANGE { || ;
IIF( nValue1 = 1, oBmp1:LoadImage( "IMAGE1" ), NIL ), ;
IIF( nValue1 = 2, oBmp1:LoadImage( "IMAGE2" ), NIL ), ;
IIF( nValue1 = 3, oBmp1:LoadImage( "IMAGE3" ), NIL ), ;
IIF( nValue1 = 4, oBmp1:LoadImage( "IMAGE4" ), NIL ), ;
oBmp1:Refresh() } UPDATE
@ 30, 70 RADIOITEM "&Mail" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 120 RADIOITEM "&Sms" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 30, 10 PIXEL UPDATE
@ 30, 170 RADIOITEM "&Telefono" RADIOMENU oRadio1 OF oFld:aDialogs[1] SIZE 45, 10 PIXEL UPDATE
AEval( oRadio1:aItems, { | oRad | ;
oRad:lTransparent := .T., ;
oRad:SetFont ( oFont ), ;
oRad:nClrText := 255 } )
// define the resource, You want to display at startup !!!
@ 70, 120 BITMAP oBmp1 RESOURCE "IMAGE1" PIXEL OF oFld:aDialogs[1] NOBORDER SIZE 32, 32 ADJUST
oBmp1:ltransparent:=.t.
used Borland resource-workshop
because of NO alpha-channel, a clean borderpainting is needed.

Best 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.
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: change bitmaps from radio button
Error occurred at: 01/29/14, 09:11:27
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LOADIMAGE
Args:
[ 1] = U
[ 2] = C NOAVVISO
Stack Calls
===========
Called from: => LOADIMAGE( 0 )
Called from: source\test2.prg => (b)INVOICE( 586 )
Called from: .\source\classes\RADMENU.PRG => TRADMENU:_NOPTION( 187 )
Called from: .\source\classes\RADMENU.PRG => TRADMENU:NEW( 125 )
Called from: source\test2.prg => INVOICE( 586 )
now run ok I put the bitmap before of the radio control
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LOADIMAGE
Args:
[ 1] = U
[ 2] = C NOAVVISO
Stack Calls
===========
Called from: => LOADIMAGE( 0 )
Called from: source\test2.prg => (b)INVOICE( 586 )
Called from: .\source\classes\RADMENU.PRG => TRADMENU:_NOPTION( 187 )
Called from: .\source\classes\RADMENU.PRG => TRADMENU:NEW( 125 )
Called from: source\test2.prg => INVOICE( 586 )
now run ok I put the bitmap before of the radio control
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com