From: thomas m. <tho...@gm...> - 2006-08-24 06:47:33
|
hi the populate method is called after a remote call to a php script made in createMenu, so I guess the app is already running. But is it a problem ? How would u go about such a case before the yesterday change ? calling the createMcs method on each menu and submenu method ? It's true I am having problems getting around the display mechanism I a not used to, would someone sum it up with examples ? tia thomas On 8/24/06, Ray Chuan <rc...@gm...> wrote: > > Hi, > > but where is the SMMenu populate method called? Before the app is run or > after? > > On 8/24/06, thomas mery <tho...@gm...> wrote: > > hi > > > > > > On 8/23/06, Ray Chuan <rc...@gm...> wrote: > > > Hi, > > > I've figured it out. It's got to do with the way windows are handled > > > in ActionStep. It's been fixed. If you want to know more, read on. > > > > > > A window is made up of MovieClips (mcs). (Actually views are but for > > > the sake of simplicity let's ignore that.) A menu contains windows. > > > So when a menu (and hence the window) is created *before* NSApp is > > > run, this takes place automatically, ie the mcs are created for you. > > > > > > But for your case, the windows are created *after* NSApp has started > > > running (I assume), so they will not have their mcs created. I've > > > changed that, so when a menu is displayed it's window is also forced > > > to create it's own mcs. > > > > > > > > mmm > > > > I don't know but the sequence was : > > > > ------ > > m_app = m_app = NSApplication.sharedApplication (); > > > > createMenu() //which contains m_mainMenu = (new > SMMenu()).initWithTitle("My > > Menu"); where SMMenu is subclassing NSMenu > > m_app.run(); > > ------ > > > > so I thought the menu was created *before" I start the app. > > > > > > > > > > > As for why you need to click it twice, apparently the display method > > > is called when the submenu is detached. Sounds weird, huh? I've fixed > > > this too. > > > > > > > > it works now, but what I don't get is why it was working with NSMenu but > not > > with my subclass ... > > > > > > thanks ! > > > > > > > On 8/23/06, thomas mery <tho...@gm...> wrote: > > > > hi all, > > > > > > > > I have tried to subclass NSMenu and have encountered a weird > behaviour. > > > > > > > > I have to click twice on my main items to make the submenus appear > (or > > have > > > > to rollover twice on submenus that have submenus) > > > > > > > > here is my code so maybe someone can tell me what i am doing wrong > ... > > > > > > > > import org.actionstep.menu.NSMenuItemCell; > > > > import org.actionstep.menu.NSMenuView ; > > > > import org.actionstep.NSApplication; > > > > import org.actionstep.NSException ; > > > > import org.actionstep.NSFont; > > > > import org.actionstep.NSMenu; > > > > import org.actionstep.NSMenuItem; > > > > import org.actionstep.NSWindow; > > > > > > > > import > > com.screenmatters.controllers.CategoriesController; > > > > import com.screenmatters.controllers.SMController ; > > > > import org.actionstep.NSPoint; > > > > > > > > /** > > > > * @author tom > > > > */ > > > > class com.screenmatters.menu.SMMenu extends NSMenu { > > > > > > > > private var m_controller:CategoriesController; > > > > > > > > private var m_itemsArray:Object; > > > > > > > > public function SMMenu() { > > > > > > > > super(); > > > > menuRepresentation().setHorizontal(false); > > > > > > > > } > > > > > > > > public function initWithTitle(title:String):SMMenu > > { > > > > > > > > super.initWithTitle(title); > > > > return this; > > > > > > > > } > > > > > > > > public function > > > > initWithController(controller:Function):SMMenu { > > > > > > > > m_controller = controller.getInstance(); > > > > > > > > return this; > > > > > > > > } > > > > > > > > public function setController(controller:Function) > > { > > > > > > > > m_controller = controller.getInstance(); > > > > > > > > return m_controller; > > > > > > > > } > > > > > > > > //returns menu controller > > > > public function controller():Object { > > > > > > > > return m_controller; > > > > > > > > } > > > > > > > > public function > > populate(itemsArray:Object,menu:SMMenu) > > > > { > > > > > > > > if(menu == null) { > > > > > > > > menu = this; > > > > > > > > } > > > > > > > > if( itemsArray.length > 0) { > > > > > > > > var mi:NSMenuItem; > > > > > > > > for(var i:Number = 0; i < itemsArray.length; i++) { > > > > > > > > var itemName = > > > > itemsArray[i]['CategoryName'][0]['name']; > > > > mi = > > > > menu.addItemWithTitleActionKeyEquivalent (itemName); > > > > mi.setTarget(this); > > > > mi.setAction("traceMenuItem"); > > > > > > > > if(itemsArray[i]['children'].length > > > 0) { > > > > > > > > var submenu = (new > SMMenu()).initWithTitle("Menu > > for " > > > > + itemName); > > > > menu.setSubmenuForItem(submenu,mi); > > > > > > > > populate(itemsArray[i]['children'],submenu); > > > > > > > > } > > > > > > > > } > > > > > > > > } > > > > > > > > } > > > > } > > > > > > > > > > > > > > > > TIA > > > > > > > > thomas > > > > > > > > > > > ------------------------------------------------------------------------- > > > > Using Tomcat but need to do more? Need to support web services, > > security? > > > > Get stuff done quickly with pre-integrated technology to make your > job > > > > easier > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > > > _______________________________________________ > > > > actionstep-core mailing list > > > > act...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/actionstep-core > > > > > > > > > > > > > > > > > > > > > -- > > > Cheers, > > > Ray Chuan > > > > > > > > > ------------------------------------------------------------------------- > > > Using Tomcat but need to do more? Need to support web services, > security? > > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > actionstep-core mailing list > > > act...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/actionstep-core > > > > > > > > > > > -- > > ---------------------------------------------------------- > > Thomas Mery en concert : > > > > Septembre > > 20/09 OPA - Paris > > > > Octobre > > 14/10 Limoges > > 15/10 --- > > 16/10 --- > > 17/10 Toulouse > > 18/10 --- > > 19/10 Bordeaux > > 20/10 --- > > 21/10 Reims > > > > Novembre > > 10/11 Macon > > > > http://www.myspace.com/thomasmery > > http://www.thomas-mery.net > > ---------------------------------------------------------- > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > _______________________________________________ > > actionstep-core mailing list > > act...@li... > > https://lists.sourceforge.net/lists/listinfo/actionstep-core > > > > > > > > > -- > Cheers, > Ray Chuan > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > actionstep-core mailing list > act...@li... > https://lists.sourceforge.net/lists/listinfo/actionstep-core > -- ---------------------------------------------------------- http://www.myspace.com/thomasmery http://www.thomas-mery.net ---------------------------------------------------------- |