Hi BarryG
You was close enough
But clicking button 1 will enable 2 again
Code: Select all
CreateImage(0,50,50)
StartDrawing(ImageOutput(0))
Box(0,0,50,50,#Yellow)
Circle(25,25,15,#Red)
StopDrawing()
OpenWindow(0,0,0,400,200,"",#PB_Window_SystemMenu |#PB_Window_ScreenCentered)
ButtonImageGadget(1,10,10,50,50,ImageID(0))
ContainerGadget(3,80,10,50,50)
ButtonImageGadget(2,0,0,50,50,0)
CloseGadgetList()
DisableGadget(3,1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Menu
Select EventMenu()
Case 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case 1
CreateImage(1, 50,50 ,24 )
hdc = StartDrawing(ImageOutput(1))
SendMessage_(GadgetID(1),#WM_PRINT,hdc, #PRF_CHILDREN| #PRF_CLIENT|#PRF_ERASEBKGND)
For y = 0 To 49
For x = 0 To 49
Color = Point(x, y)
NChrome = Round(Red(Color) * 0.33 + Green(Color) * 0.46 + Blue(Color) * 0.11, 0)
Plot(x, y, RGB(NChrome,NChrome,NChrome))
Next
Next
StopDrawing()
SetGadgetAttribute(2,#PB_Button_Image,ImageID(1))
EndSelect
EndSelect
Until Quit = 1
End
Button 1 is toggle to enable \ disable button 2
Code: Select all
CreateImage(0,50,50)
StartDrawing(ImageOutput(0))
Box(0,0,50,50,#Yellow)
Circle(25,25,15,#Red)
StopDrawing()
OpenWindow(0,0,0,400,200,"",#PB_Window_SystemMenu |#PB_Window_ScreenCentered)
ButtonImageGadget(1,10,10,50,50,ImageID(0))
ContainerGadget(3,80,10,50,50)
ButtonImageGadget(2,0,0,50,50,0)
CloseGadgetList()
;DisableGadget(3,1)
CreateImage(1, 50,50 ,24 )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Menu
Select EventMenu()
Case 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Run ! 1
If Run = 1
hdc = StartDrawing(ImageOutput(1))
SendMessage_(GadgetID(1),#WM_PRINT,hdc, #PRF_CHILDREN| #PRF_CLIENT|#PRF_ERASEBKGND)
For y = 0 To 49
For x = 0 To 49
Color = Point(x, y)
NChrome = Round(Red(Color) * 0.33 + Green(Color) * 0.46 + Blue(Color) * 0.11, 0)
Plot(x, y, RGB(NChrome,NChrome,NChrome))
Next
Next
StopDrawing()
SetGadgetAttribute(2,#PB_Button_Image,ImageID(1))
DisableGadget(3,1)
Else
hdc = StartDrawing(ImageOutput(1))
SendMessage_(GadgetID(1),#WM_PRINT,hdc, #PRF_CHILDREN| #PRF_CLIENT|#PRF_ERASEBKGND)
StopDrawing()
SetGadgetAttribute(2,#PB_Button_Image,ImageID(1))
DisableGadget(3,0)
EndIf
EndSelect
EndSelect
Until Quit = 1
End