Page 1 of 1

Gadget on image

Posted: Tue Apr 02, 2024 9:31 pm
by Bmld756
hello,

Do you know why if I put a button on an image, it works on MacOs but It don't work on windows.

Image Image

little test program

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  If CreateImage(0, 1400-20, 2200, 32,  RGB(239, 239, 239)) And StartDrawing(ImageOutput(0))
      Box(1,i,1400-20, 40, RGB(216, 244, 254))
    StopDrawing() 
    ImageGadget(0, 0, 0, 200, 200, ImageID(0))
  EndIf
  
  ButtonGadget(1, 10, 10, 200, 20, "Standard Button")
 
  Repeat 
  
  Event = WaitWindowEvent()
  Gadget = EventGadget();
  Type_Event= EventType()

  Select Event
    Case #PB_Event_Gadget  
      Select Gadget
        Case 1
          Debug "bouton"
      EndSelect
  EndSelect 
  
  Until WaitWindowEvent() = #PB_Event_CloseWindow
  
  
EndIf

My goal is to create a list white blue and white lines. I create a container with a lot of button, text and string on an image , the blue and white lines. It works fine on MacOs but not on Windows.

Image

Re: Gadget on image

Posted: Tue Apr 02, 2024 10:18 pm
by Fred
You should use a Canvasgadget() with container flag, gadget overlapping isn't supported in PB

Re: Gadget on image

Posted: Tue Apr 02, 2024 10:52 pm
by RASHAD
OR

Code: Select all

If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  If CreateImage(0, 1400-20, 2200, 32,  RGB(239, 239, 239)) And StartDrawing(ImageOutput(0))
      Box(1,i,1400-20, 40, RGB(216, 244, 254))
    StopDrawing() 
    ImageGadget(0, 0, 0, 200, 200, ImageID(0))
  EndIf
  ;*****************
  CompilerIf #PB_Compiler_OS = #PB_OS_Windows 
    DisableGadget(0,1)
  CompilerEndIf
  ;*****************
  ButtonGadget(1, 10, 10, 200, 20, "Standard Button")
 
  Repeat 
  
  Event = WaitWindowEvent()
  Gadget = EventGadget();
  Type_Event= EventType()

  Select Event
    Case #PB_Event_Gadget  
      Select Gadget
        Case 1
          Debug "bouton"
      EndSelect
  EndSelect 
  
  Until Event = #PB_Event_CloseWindow  
  
EndIf

Re: Gadget on image

Posted: Wed Apr 03, 2024 8:25 am
by Bmld756
Fred wrote: Tue Apr 02, 2024 10:18 pm You should use a Canvasgadget() with container flag, gadget overlapping isn't supported in PB
That's what I thought. Thank.