How to change Bitmap on the fly for SBTN?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

Try it this way:

Code: Select all

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: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Antonio,

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

Code: Select all

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