I’m trying to get back my window from a tag in a menu item.
I previously added a window to a menuitem’ tag using (wm is my window’s menu)
aMenu = new MenuItem( aWindow.Title)
aMenu.Tag = aWindow
if wm.Count<13 then
aMenu.KeyboardShortcut = kCommandKeyMenu+"-"+chr(asc("0")+(wm.Count-3))
end if
wm.Append aMenu
then later in the menuitem action I try to retrieve the window with : (me is a menuitem)
dim mywindow as Window
mywindow = Window(me.Tag.WindowPtrValue)
and I get an error : “type error waiting for Ptr but got Window” when I compile.
can anybody tell me how to get back my window from the tag field of the menuitem ?
when I trace the program, I have my window I want in the Tag field of the menuitem, but I cannot get it back in a variable …
thanks.
If you’re targeting OS X, I wrote a window tricks article for the XDev magazine and in there is the code to get the OS to manage the Window Menu for you, you get the tick marks and diamonds for free.