Nice
Per drag and drop to textview
Code: Select all
;-TOP
Procedure ShowEmojiPicker()
Protected NSApp = CocoaMessage(0, 0, "NSApplication sharedApplication")
If NSApp
CocoaMessage(0, NSApp, "orderFrontCharacterPalette:", #nil)
EndIf
EndProcedure
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Resize Gadgets
ResizeGadget(0, 5, 5, dx-10, dy-10-50)
ResizeGadget(1, 5, dy-40, 200, 25)
EndProcedure
Procedure Main()
Protected dx, dy, text.s
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #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, 5, 5, dx-10, dy-10-50)
ButtonGadget(1, 5, dy-40, 200, 25, "Show Emoji Picker")
EnableGadgetDrop(0, #PB_Drop_Text, #PB_Drag_Copy)
CocoaMessage(0, GadgetID(0), "setUsesInspectorBar:", #True)
CocoaMessage(0, GadgetID(0), "setRulerVisible:", #True)
UpdateWindow()
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
; 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()
Case 1
SetActiveGadget(0)
ShowEmojiPicker()
EndSelect
Case #PB_Event_GadgetDrop
Select EventGadget()
Case 0
text = EventDropText()
CocoaMessage(0,GadgetID(0),"insertText:$", @text)
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()