XULStdAppMenu :: 10 lines of code to create really deeper menu in SiteFusion

USAGE :

// Istantiate and add the classto the Application window

$this->window->addChild(
$top = new XULStdAppMenu()
);

// Only create root menu is required, after you can “overwrite” and redeclare all menu
// without any problem because after the first creation, the class recall the created menu

$top->addMenuRoot(‘File’,NULL); OR $top->addMenuRoot(‘File’,NULL,[b]TRUE[/b]); to add the root menu on the right

// Add a standard application menu
$top->addMenu(
'File','File'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

Examine : $top->addMenu('File','File',array(menus) );

add menu or menu contained in array(Somemenus) to rootMenu(‘File’) in group(‘File’)

Examine : array('New', $this, 'noEventYet')
New = the label of the menu
$this->noEventYet();

Examine : array(NULL,NULL,NULL) // it's a separator

Attention : After you call the method addMenuRoot ( ex.  $top->addMenuRoot(‘File’,NULL); )

you can do this :

$top->addMenu(
'File','FileSubMenu'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

or this :

$top->addMenu(
'File','FileSubMenu'
,array(array('New', $this, 'noEventYet'))
);

$top->addMenu(
'File','FileSubMenu'
,array(array('File', $this, 'noEventYet'))
);

$top->addMenu(
'File','FileSubMenu'
,array(array('Exit', $this, 'noEventYet'))
);

or this :

$top->addMenu(
'File','FileSubMenu'
,array(array('New', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubMenu','FileSubSubMenu'
,array(array('File', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubSubMenu','FileSubSubSubMenu'
,array(array('Exit', $this, 'noEventYet'))
);

$top->addMenu(
'FileSubSubSubMenu','FileSubSubSubMenu'
,array(
array('New', $this, 'noEventYet'),
array('Open', $this,'noEventYet'),
array(NULL,NULL,NULL),
array('Exit', $this, 'noEventYet')
)
);

Or Like this :

$top->addMenuRoot(‘TestDeepRef’,NULL);
$top->addMenuRoot(‘TestDeepRef’,'TestDeepRef2′);
$top->addMenuRoot(‘TestDeepRef2′,’TestDeepRef3′);
$top->addMenuRoot(‘TestDeepRef3′,’TestDeepRef4′);

$top->addMenu(
‘TestDeepRef4′
,’TestDeepRef4′
,array(
array(‘openAbout’, $this, ‘openAbout’),
array(‘openAboutMemory’, $this,’openAboutMemory’),
array(‘openExtensions’, $this, ‘openExtensions’),
array(‘openErrorConsole’,$this,’openErrorConsole’)
)
);

$top->addMenu(
‘TestDeepRef3′
,’TestDeepRef3′
,array(
array(‘openAbout’, $this, ‘openAbout’),
array(‘openAboutMemory’, $this,’openAboutMemory’),
array(‘openExtensions’, $this, ‘openExtensions’),
array(‘openErrorConsole’,$this,’openErrorConsole’)
)
);

Sitefusion it’s really simple to use and extends!

File Download : testTopMenu.startup.php

This entry was posted in SiteFusion. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>