Problem with imagelists in a Toolbar, seemable false indexes
Posted: Sun Jan 09, 2005 5:16 pm
Hi, sorry for enerving you
I hope, it´s the right place here, there a many apis in the source, so I´ve put it here
I tried to create a "blinking" toolbar, changing the image of a toolbarbutton every second with help of a timer.
For this I used tb_addbitmap to add an image to the list.
Normaly, it should return the index in the imagelist but it returns a wrong worth, as it seems.
Here´s the code:
Normaly, there should be first a pink and than a blue circle, but
there is a pink and than a white one
Anyone who can help me?
I hope, it´s the right place here, there a many apis in the source, so I´ve put it here
I tried to create a "blinking" toolbar, changing the image of a toolbarbutton every second with help of a timer.
For this I used tb_addbitmap to add an image to the list.
Normaly, it should return the index in the imagelist but it returns a wrong worth, as it seems.
Here´s the code:
Code: Select all
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
;Creating the toolbaricons and drawing different colored circles
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,1,egal)
SetTimer_(WindowID(1),0,1000,@ErrorTimer())
Repeat
event=WaitWindowEvent()
Until event=#WM_CLOSE
EndIf
End Normaly, there should be first a pink and than a blue circle, but
there is a pink and than a white one
Anyone who can help me?