I've created a bevel button (with help from TWM :-)) with a graphic
that uses a cicn resource. Initial display in the window works fine.
My question is how to change the graphic (i.e. use a different cicn)
on the button. Using a shortened version (i.e. appearance button
1,,,,_cIcon2,"xxxxxx") of the appearance button statement with only
the parameters I want to change doesn't work(maybe user error here) .
I can make it work by doing a button close -1 and rebuilding the
button, but this seems like overkill not to mention inelegant. I'm
thinking only the SetButtonDatas need to be changed, but I don't know
how with this type of button.
The following code snippet shows how the button is created.
_cIcon1 = 1000
_cIcon2 = 1001
_kControlBevelButtonKindTag = _"bebk"
_kThemeRoundedBevelButton = 15
dim as WindowAttributes wa
dim as rect r
dim as short @ setVal
wa = _kWindowCloseBoxAttribute¬
_kWindowCollapseBoxAttribute¬
_kWindowResizableAttribute
SetRect(r, 633, 363, 972, 794)// w: 339 h: 431
appearance window -1, "Test", @r, _kDocumentWindowClass, wa
def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue)
SetRect(r, 250, 7, 320, 72)
appearance button 1, _activeBtn, 0,
_kControlContentCIconRes_kControlBehaviorToggles, _cIcon1,"Hold", @r,
_kControlBevelButtonSmallBevelProc
setVal = _kControlBevelButtonPlaceBelowGraphic
def SetButtonData(1, _kControlEntireControl,
_kControlBevelButtonTextPlaceTag, SizeOf(short), setVal)
setVal = _kThemeRoundedBevelButton
def SetButtonData(1, _kControlEntireControl,
_kControlBevelButtonKindTag, SizeOf(Short), setVal)
appearance window 1
do
handleevents
until gFBquit
' end of code
I'm also toying with the following which I borrowed from Matt's demo:
Appearance Button 1, _ActiveBtn, 0, 0, 0,
"",@r,_kControlBevelButtonSmallBevelProc
Content.ContentType = _kControlContentCIconHandle
Content.CIconHandle = Fn GetCIcon (128)
def SetButtonData( 1, _kControlEntireControl, _"cont", sizeof
( Content ), Content )
TIA----Brian S.