How to change Bitmap on the fly for SBTN?

Post Reply
User avatar
dutch
Posts: 1571
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand
Been thanked: 2 times

How to change Bitmap on the fly for SBTN?

Post by dutch »

Dear All,

How to change BitMap (Resource) in TSBUTTON after Dialog ACTIVATE?

Example ( not work )
======

Code: Select all | Expand

DEFINE DIALOG RESOURCE 'TEST'

REDEFINE SBUTTON oBtn PROMPT 'TEST' ID 11 OF oDlg ;
                ACTION ChangeBitMap( oBtn )

ACTIVATE DIALOG oDlg

Function ChangeBitMap( oBtn )
oBtn:hBitMap1 := LoadBitmap( GetResources(), 'SMILE' )
oBtn:Refresh()
return nil


Best Regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 42759
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 112 times
Been thanked: 108 times
Contact:

Post by Antonio Linares »

Dutch,

Try it this way:

Code: Select all | Expand

REDEFINE SBUTTON oBtn PROMPT 'TEST' ID 11 OF oDlg ; 
                ACTION ( oBtn:LoadBitmaps( "smile" ), oBtn:Refresh() )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1571
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand
Been thanked: 2 times

Post by dutch »

Dear Antonio,

Thanks for your prompt reply. I've got it.

Code: Select all | Expand

DEFINE DIALOG RESOURCE 'TEST' 

REDEFINE SBUTTON oBtn PROMPT 'TEST' ID 11 OF oDlg ;
                ACTION ChangeBitMap( oBtn )

ACTIVATE DIALOG oDlg

Function ChangeBitMap( oBtn )
oBtn:LoadBitmaps( { 'SMILE' }, {} )   // ( aResource, aBmpFile )
oBtn:Refresh()
return nil


Best regards,
Dutch
Post Reply