dcsimg

CXmlMenu'�Display Menus from XML Files

WEBINAR:
On-Demand

Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


Environment: VC6

This article covers the need for the dynamic creation of menus from XML files. Menus represent tree data structures exactly as XML files do. In case you have some data stored in an XML file and you want to select a specific item from it, wouldn't it be nice to have something like this:

CXmlMenu menu;

//display the menu and get user selection
CString answer = menu.TrackXml(this,"example.xml","name");

if (answer!="")
  MessageBox("You selected \"" + answer + "\"");

This is exactly what the CXmlMenu class does. It can create a menu by reading a specific attribute of the items of an XML file (attribute "name" is selected in the example above); it displays the menu and returns the attribute of the selected item.

The code for XML file handling is taken from Pablo van der Meer.

Downloads

Download demo project - 129 Kb
Download source - 6 Kb


Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date