Spelling and Grammar in ConstructContextualMenu

I am creating a custom contextual menu for a TextArea… and need to add Spelling and Grammar?
(both macOS and Win if it makes a difference)

Dim mm As MenuItem
Dim hasTxt As Boolean=(Len(Me.Text)>0)
Dim hasSel As Boolean =(Me.SelLength>0)

//base.Append(EditUndo.clone)
//
mm=EditCut.clone
mm.enabled=(hassel)
base.append(mm)
//
mm=EditCopy.clone
mm.enabled=(hassel)
base.append(mm)
//
Dim cb As New Clipboard
mm=EditPaste.clone
mm.Enabled=(cb.TextAvailable)
base.append mm
//
base.append(EditSeparator1.clone)
//
mm=EditClear.clone
mm.enabled=(hassel)
base.append(mm)
//
mm=EditSelectAll.clone
mm.Enabled=hasTxt
base.append mm

darn

Tried to decypher the code in MacOSLib to no avail… I can’t load it into 2019 (2012 only) and can’t make heads or tails since there is little to no comments included

so why doesn’t this work?

Public Sub CheckSpelling(t as textarea)
 #If TargetCocoa Then
    Declare Sub showGuessPanel Lib "Cocoa" selector "showGuessPanel:" (obj_id As Integer, sender As Integer)
    
    showGuessPanel(t.Handle, t.Handle)
  #Else
    #Pragma Unused t
  #EndIf
  
End Sub

it calls showGuessPanel, but nothing happens

Do you have some selected text before calling ?

Ok… I managed to cobble together a working menu item…

Had to create a replacement version of MenuItem (based on code from MacOSLib)

it works. but the z-order of the spelling panel is below the current active window… making it non accessible