Hi all!
Question:
Could anyone explain
how an EventHandler works in OSX for 'dragging'
(making a selection horizontally)?
It's clear about the 'DragStartEvent',
but don't know how to check for the 'DragEndEvent'
(it's not a drop, but to create a selection in a WindowedScreen)
PS, maybe it's not possible in OSX,
because SetDragCallback(@DragCallback())
isn't available in OSX??
Thanks for any help!
Regards,
Danny Weijermans
Drag EventHandler in OSX
- DannyWeijermans
- User
- Posts: 26
- Joined: Thu Aug 25, 2022 10:10 pm
- Contact:
Re: Drag EventHandler in OSX
With BindEvent ...
Code: Select all
;-TOP
Procedure DoEventDropText()
AddGadgetItem(0, -1, EventDropText())
EndProcedure
; ----
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Resize Gadgets
ResizeGadget(0, 0, 0, dx, dy)
EndProcedure
Procedure Main()
Protected dx, dy
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window Drop Text", #WinStyle)
; MenuBar
CreateMenu(0, WindowID(0))
MenuTitle("&File")
MenuItem(99, "E&xit")
; StatusBar
CreateStatusBar(0, WindowID(0))
AddStatusBarField(#PB_Ignore)
; Gadgets
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
EditorGadget(0, 0, 0, dx, dy)
EnableGadgetDrop(0, #PB_Drop_Text, #PB_Drag_Copy)
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
BindEvent(#PB_Event_GadgetDrop, @DoEventDropText())
; Main Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 99
PostEvent(#PB_Event_CloseWindow, 0, 0)
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()
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
- DannyWeijermans
- User
- Posts: 26
- Joined: Thu Aug 25, 2022 10:10 pm
- Contact:
Re: Drag EventHandler in OSX
PS, I solved it tracking also the MouseUp status using Cocoa..
Thanks so much, mk-soft!
In my case it's not text,
but a WindowedScreen containing a picture.
And I want to select a region in this picture.
I know how to get the first position when clicked,
but as soon as you start to drag,
I don't know how to track that..
Any idea?
Thanks again!
Regards, Danny Weijermans - The Netherlands
Thanks so much, mk-soft!
In my case it's not text,
but a WindowedScreen containing a picture.
And I want to select a region in this picture.
I know how to get the first position when clicked,
but as soon as you start to drag,
I don't know how to track that..
Any idea?
Thanks again!
Regards, Danny Weijermans - The Netherlands