[Project_owners] template confusion

Paul Tomlin paul at paultomlin.com
Tue Oct 11 18:50:13 EDT 2005

I have a bit of XUL, like the following, which generates a drop list of 
the available mail accounts within TB.

<menulist id="search.root.selected-account.uri"
   datasources="rdf:msgaccountmanager rdf:mailnewsfolders"

   <template xmlns:nc="http://home.netscape.com/NC-rdf#">
     <rule nc:ServerType="nntp" />
     <rule nc:IsServer="true">
         <menuitem uri="..."
                   label="rdf:http://home.netscape.com/NC-rdf#Name" />

I have registered an event listener via addEventListener

	.addEventListener('command', onCommand, true);

to handle all the command events. This is done tom simplfy the code and 
not have 15 million functions, 1 for each control. Not sure if this is 
ideal, but seems to make sense to me.

The above event listener works fine for most things, like radios and 
checkboxes. However, for the generated content in the menupopup I get 
the @uri value when inspecting event.target.id from within the event 

function onCommand(ev) { dump(ev.target.id); }

I'm not sure if it's possible but I think I'd like to be able to assign 
@id values to the menuitem such that I can be sure I know what they are 
when I see the event. At the moment I have to presume that if 
ev.target.id =~ |^mailbox://| then the event has come from the menupopup.

Neil, I've tried looking at your template tuts, but there's soooo many 
and I'm not too sure what I should be looking for in terms of language. 
If you have done an article about this then please nudge me in that 
direction :)

Otherwise, anyone got a clue how I should be doing this?

More information about the Project_owners mailing list