Checkmarks on PopupMenu items

It is called a PullDown menu. It’s a completely stock PopupMenu with a system call to change the arrow on the end to point downwards.

Const CocoaLib = "AppKit"

Const NSPopUpArrowAtBottom = 2

Declare Function cell Lib CocoaLib selector "cell" ( id As Integer ) As Integer
Declare Sub setPullsDown Lib CocoaLib selector "setPullsDown:" ( id As Integer, value As Boolean )
Declare Sub setArrowPosition Lib CocoaLib selector "setArrowPosition:" ( id As Integer, value As Integer )

Dim ctrlHandle As Integer = Me.Handle
Dim cellHandle As Integer = cell( ctrlHandle )

setpullsDown( cellHandle, True )
setArrowPosition( cellHandle, NSPopUpArrowAtBottom )
1 Like

You can also try the BevelButton or PictureButton (plugin)

I don’t think either of those provide a popup menu as standard.

1 Like

As it says:

On macOS, BevelButton is not a native control and does not automatically change its appearance in dark mode.

Which makes it not worth the effort. With a small call and very little effort I can use the stock PopupMenu and make it look the way it’s supposed to do. You can even add the menu elements in the Xojo interface. The first row the the label on the control and the rest appear on the popup menu. Under the hood they’re both the same control, just with a call to setPullsDown and setArrowPosition. It’s also completely Dark Mode compatible with zero extra code. (just remove the background colour if you’re using a floating window).


Hmm… that’s the other right :wink: (a.k.a “wrong”).

1 Like

Ha. correct. I meant left. :slight_smile:

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.