From: thomas m. <tho...@gm...> - 2006-08-22 22:38:12
|
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 |
From: Ray C. <rc...@gm...> - 2006-08-23 16:28:52
|
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. 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. 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 |
From: thomas m. <tho...@gm...> - 2006-08-23 16:45:42
|
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 ---------------------------------------------------------- |
From: Ray C. <rc...@gm...> - 2006-08-23 23:44:21
|
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 |
From: Scott H. <sc...@af...> - 2006-08-24 01:48:07
|
I also notice that your initWithController() method doesn't call super.init(). This is usually quite important. Scott On 23/08/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 > |
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 ---------------------------------------------------------- |
From: Ray C. <rc...@gm...> - 2006-08-26 14:39:36
|
Hi, On 8/24/06, thomas mery <tho...@gm...> wrote: > 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 ? Exactly. Invoke display on every menu when they are created. In your case, you can add that invocation in the loop when submenus are created. > It's true I am having problems getting around the display mechanism I a not > used to, would someone sum it up with examples ? Look at the documentation on osflash here: http://osflash.org/actionstep/documentation/views Feel free to post here if you find it insufficient. > 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 > ---------------------------------------------------------- > ------------------------------------------------------------------------- > 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 |
From: thomas m. <tho...@gm...> - 2006-08-24 06:52:03
|
hi yes I thought about that, this leads me to this question can I call super.init() every time I subclass for safety ? How would I know what are the necessary steps when subclassing ? For example I subclassed NSButton and I think I had to override cellClass and setCellClass, is that right ? (Or could I just have called setClass on my custom button ? ) But Is there a way to know for sure what needs to be overwritten to make sure the child class works ? I know that in the appKit API reference there are infos about that, is it where I should always look ? sorry for all the questions but I really like ActionStep and would really like to understand better :) thomas On 8/24/06, Scott Hyndman <sc...@af...> wrote: > > I also notice that your initWithController() method doesn't call > super.init(). This is usually quite important. > > Scott > > On 23/08/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 > > > > ------------------------------------------------------------------------- > 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 ---------------------------------------------------------- |
From: Scott H. <sc...@af...> - 2006-08-25 12:52:52
|
That's a really good question. Most of the time, yes, you should call super.init()...unless you're overriding something like initWithFrame, in which case you should call super.initWithFrame(). And no, there isn't somewhere you should always look. But you must call an initializer in the superclass, without fail. Sometimes things will go very wrong if you don't. And don't worry about asking questions. It just makes us think a little bit. Ask away. :) Scott On 24/08/06, thomas mery <tho...@gm...> wrote: > hi > > yes I thought about that, this leads me to this question > > can I call super.init() every time I subclass for safety ? How would I know > what are the necessary steps when subclassing ? For example I subclassed > NSButton and I think I had to override cellClass and setCellClass, is that > right ? (Or could I just have called setClass on my custom button ? ) But Is > there a way to know for sure what needs to be overwritten to make sure the > child class works ? > > I know that in the appKit API reference there are infos about that, is it > where I should always look ? > > > sorry for all the questions but I really like ActionStep and would really > like to understand better :) > > thomas > > > On 8/24/06, Scott Hyndman <sc...@af...> wrote: > > I also notice that your initWithController() method doesn't call > > super.init(). This is usually quite important. > > > > Scott > > > > On 23/08/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 > > > > > > > > ------------------------------------------------------------------------- > > 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 > ---------------------------------------------------------- > ------------------------------------------------------------------------- > 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 > > > |