Can you check this out? (mac os)
Re: Can you check this out? (mac os)
Can't move the button on MacOS 13.1.1 which is logical.
The button is gadget number 2 and you are only catching events for gadget number 0.
The button is gadget number 2 and you are only catching events for gadget number 0.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Can you check this out? (mac os)
Just this code works like a charm in the windows and linux.
So I wanted it to work in macos.
So I wanted it to work in macos.

Re: Can you check this out? (mac os)
On MacOS the button receives the events where the button covers the canvas, not the canvas behind the button.mestnyi wrote:Just this code works like a charm in the windows and linux.
So I wanted it to work in macos.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Can you check this out? (mac os)
Found a solution for Mac OS.
This is a very convenient solution to make canvas transparent.
This is a very convenient solution to make canvas transparent.
Code: Select all
If OpenWindow(0, 0, 0, 220, 220, "Гаджет Канвас (Холст)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(2,10,10,70,20,"move me")
CanvasGadget(0, 10, 10, 70, 20)
If StartDrawing( CanvasOutput(0) )
FillMemory( DrawingBuffer(), DrawingBufferPitch() * OutputHeight())
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventGadget() = 0
If EventType() = #PB_EventType_LeftButtonUp
ResizeGadget(0,x,y,#PB_Ignore,#PB_Ignore)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
HideGadget(0,0)
CompilerEndIf
EndIf
If EventType() = #PB_EventType_LeftButtonDown
OffsetX = GetGadgetAttribute(0, #PB_Canvas_MouseX)
OffsetY = GetGadgetAttribute(0, #PB_Canvas_MouseY)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
HideGadget(0,1)
CompilerEndIf
EndIf
If (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
x = WindowMouseX(0)-OffsetX
y = WindowMouseY(0)-OffsetY
ResizeGadget(2,x,y,#PB_Ignore,#PB_Ignore)
CompilerIf #PB_Compiler_OS <> #PB_OS_Windows
ResizeGadget(0,x,y,#PB_Ignore,#PB_Ignore)
CompilerEndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Re: Can you check this out? (mac os)
can you check what the "LeftClickEvent()" procedure returns?
Code: Select all
; https://www.purebasic.fr/english/viewtopic.php?t=60782
Procedure LeftClickEvent()
Debug "click"
Debug Str(EventMenu()) ; why return 111?
Debug Str(EventGadget()) ; why return 111?
Debug Str(EventWindow())
EndProcedure
If OpenWindow(111, 0, 0, 100, 100, "UnbindEvent", #PB_Window_SystemMenu )
BindEvent(#PB_Event_LeftClick,@LeftClickEvent())
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Re: Can you check this out? (mac os)
On my Windows 11 Home, it returns:
Click
0
0
111
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
Re: Can you check this out? (mac os)
Tested on Windows 10 Home (64-bit), and Windows 7 Ultimate (64-bit). Results are:
Click
0
0
111
Re: Can you check this out? (mac os)
You need to check it on Mac OS 

Re: Can you check this out? (mac os)
See PB SDK or PostEvent.mestnyi wrote: Thu Apr 11, 2024 9:02 pm can you check what the "LeftClickEvent()" procedure returns?Code: Select all
; https://www.purebasic.fr/english/viewtopic.php?t=60782 Procedure LeftClickEvent() Debug "click" Debug Str(EventMenu()) ; why return 111? Debug Str(EventGadget()) ; why return 111? Debug Str(EventWindow()) EndProcedure If OpenWindow(111, 0, 0, 100, 100, "UnbindEvent", #PB_Window_SystemMenu ) BindEvent(#PB_Event_LeftClick,@LeftClickEvent()) Repeat Event = WaitWindowEvent() Until Event = #PB_Event_CloseWindow EndIf
When an event is received, it is the object.
Code: Select all
Result = PostEvent(Event [, Window, Object [, Type [, Data]]])
Therefore, 'Event' must always be evaluated first.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Can you check this out? (mac os)
I can move it for a few pixels but only if I click EXACTLY on top-left corner... it's like it falls from the cursor…
Edit: saw you posted another:
Mac Monterey M1
Edit: saw you posted another:
This one "jumps away" from the cursor when I click it, but then I can move itmestnyi wrote: Fri Jul 03, 2020 11:35 pm Found a solution for Mac OS.
This is a very convenient solution to make canvas transparent.
Mac Monterey M1
Re: Can you check this out? (mac os)
Found part of the problem: works better if monitor is NOT set to high (retina) resolution
Re: Can you check this out? (mac os)
If all you want is for the button to move then this code works fine here and button moves smoothy. https://www.purebasic.fr/english/viewto ... 70#p557070
PS
click
111
111
111
PS
click
111
111
111
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20