Gadget on image

Just starting out? Need help? Post your questions and find answers here.
Bmld756
User
User
Posts: 30
Joined: Mon Sep 19, 2022 3:30 pm

Gadget on image

Post 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
IMAC 21.5 2012 Core I5 - 2.70 Ghz. 16 GB NVIDIA GeForce GT 640M 512 Mo. MacOs OCPL Sequoia 15.0
MacBook Air M1 - 8Go - Sonoma 14.1
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Gadget on image

Post by Fred »

You should use a Canvasgadget() with container flag, gadget overlapping isn't supported in PB
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Gadget on image

Post 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
Egypt my love
Bmld756
User
User
Posts: 30
Joined: Mon Sep 19, 2022 3:30 pm

Re: Gadget on image

Post 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.
IMAC 21.5 2012 Core I5 - 2.70 Ghz. 16 GB NVIDIA GeForce GT 640M 512 Mo. MacOs OCPL Sequoia 15.0
MacBook Air M1 - 8Go - Sonoma 14.1
Post Reply