Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Re: image to NSMenuItemMBS.View (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] [ANN] 11.1pr11
Next thread: [MBS] pic to NSMenuMBS.View


Re: [MBS] MBS Icon Routines redefined?   -   Garth Hjelte
  [MBS] Re: image to NSMenuItemMBS.View   -   Aaron Andrew Hunt
    [MBS] image to NSMenuItemMBS.View   -   Aaron Andrew Hunt

[MBS] Re: image to NSMenuItemMBS.View
Date: 22.04.11 02:52 (Thu, 21 Apr 2011 21:52:29 -0400)
From: Aaron Andrew Hunt
Ah, it turns out that I was simply losing the reference to the NSMenuItemMBS. It works now.

For anyone interested:

To get an image in the menu:

have an NSMenuMBS that exists

make i = new NSMenuItemMBS <-- and keep the reference alive!

dim v as NSImageViewMBS(0,0,pic.width,pic.height)
v.image = new NSImageMBS(pic)
i.view = v
NSMenu.AddItem i

Cheers,
Aaron

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

[MBS] image to NSMenuItemMBS.View
Date: 22.04.11 00:45 (Thu, 21 Apr 2011 19:45:18 -0400)
From: Aaron Andrew Hunt
(NOTE: in my previous post I accidentally said NSMenuMBS.View when it is NSMenuItemMBS.View. This is corrected.)

How do I assign an image to an NSMenuItemMBS.View?

I have existing:
m as NSMenuMBS
i as NSMenuItemMBS
pic, mask as picture

I try:

dim imageView as new NSImageViewMBS
dim view as NSViewMBS

imageView.image = new NSImageMBS(pic, mask)
View = iv
i.view = View
m.AddItem i

But it doesn't work. I want the menu item to show the picture. I don't want to use the .image property of NSMenuItemMBS because that is supposed to be a small icon and a larger picture makes the menu item very wide. the view should let the image be the whole width. Any help?

Thanks!
Aaron
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info