[Project_owners] menulist template for sequence

Paul Tomlin paul at paultomlin.com
Tue Mar 14 11:29:37 EST 2006


Is there a way to generate a menulist, or rather the menuitems for a 
menupopup in a menulist, for a sequence of characters.

Back to the shortcut selection dialog and although I can hardcode the 
list of keys that can be used, I'd like to make it cleaner in the code 
and generate the a-z sequence automatically.

Replace:

<menulist>
	<menupopup>
		<menuitem label="disabled" value="" />

		<menuitem label="A" value="A" />
		<menuitem label="B" value="B" />
		...
		<menuitem label="Z" value="Z" />

		<menuitem label="/" value="/" />
		<menuitem label="\" value="\" />
		<menuitem label="#" value="#" />
	</menupopup>
</menulist>

With:

<menulist>
	<menupopup>
		<menuitem label="disabled" value="" />

		<!-- pseudo code approaching -->
		<template from="a" to="z">
			<menuitem
				value="?"
				label="?" />
		</template>

		<menuitem label="/" value="/" />
		<menuitem label="\" value="\" />
		<menuitem label="#" value="#" />
	</menupopup>
</menulist>



Nothing major, just wondering


More information about the Project_owners mailing list