Eigentlich sollte in diesem Codebeispiel der ganz rechte, also 6.te Toolbarbutton zwischen Pinkem (#image=5) und Blauem (#image=6) Kreis wechseln, er wechselt aber zwischen Pinkem (#image=5) und Weißem (#image=1) Kreis.
Da der Pinke kreis als ausgangsbild genommen wurde, schließe ich, dass bei tb_addbitmap irgendwas falsch läuft.
Seltsamerweise gibt die funktion aber einen wert zurück, laut dem es funktionieren müsste

Hier mal der Code:
Code: Alles auswählen
Global toolbar_id.l
Dim Imgs(1)
Procedure ErrorTimer()
Static error.b
error=1-error
SendMessage_(toolbar_id,#tb_changebitmap,5,Imgs(error))
ProcedureReturn 1
EndProcedure
For a=0 To 6
CreateImage(a,16,16)
Next
UseImage(0)
StartDrawing(ImageOutput())
FrontColor(255,255,255)
Circle(8,8,8)
StopDrawing()
UseImage(1)
StartDrawing(ImageOutput())
FrontColor(255,0,0)
Circle(8,8,8)
StopDrawing()
UseImage(2)
StartDrawing(ImageOutput())
FrontColor(0,255,0)
Circle(8,8,8)
StopDrawing()
UseImage(3)
StartDrawing(ImageOutput())
FrontColor(0,0,255)
Circle(8,8,8)
StopDrawing()
UseImage(4)
StartDrawing(ImageOutput())
FrontColor(255,255,0)
Circle(8,8,8)
StopDrawing()
UseImage(5)
StartDrawing(ImageOutput())
FrontColor(255,0,255)
Circle(8,8,8)
StopDrawing()
UseImage(6)
StartDrawing(ImageOutput())
FrontColor(0,0,255)
Circle(8,8,8)
StopDrawing()
If OpenWindow(1,300,400,200,60,#PB_Window_SystemMenu,"Toolbarproblem")
toolbar_id=CreateToolBar(1,WindowID())
For a=0 To 5
ToolBarImageButton(a,UseImage(a))
Next
egal.tbaddbitmap
egal\Hinst=0
egal\nID=UseImage(6)
Imgs(1)=SendMessage_(toolbar_id,#tb_getbitmap,5,0)
Imgs(0)=SendMessage_(toolbar_id,#tb_addbitmap,2,egal)
SetTimer_(WindowID(1),0,1000,@ErrorTimer())
Repeat
event=WaitWindowEvent()
Until event=#WM_CLOSE
EndIf
End