Register to post in forums, or Log in to your existing account
 

zMUD Map Database Demo [[MapDemo]] 
This demonstration program allows you to open a zMUD or zMapper *.MDB map database and browse it's contents. It shows how more of the zApp components are data-aware. It also shows some additional data-aware components, such as the Lookup Combo box that displays the list of zones in the database. This is a live database application and all of the fields being displayed can be freely edited. The previous Database Demo program showed how general databases could be accessed in a very generic way, while this application shows how zApp can be used to provide a high quality user interface to a very specific database application.



Here is the zApp XML source code for this application:
Code:
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE zapp [
  <!ENTITY AppTitle "zApp Demo: Database browser">
  <!ENTITY AppAuthor "Zugg Software">
  <!ENTITY AppVersion "1.0">
  <!ENTITY AppURL "http://www.zuggsoft.com/">
  <!ENTITY AppImage "ZAPP">
  <!ENTITY AboutBox SYSTEM "aboutbox.xml">
  ]>
<zapp>
  <splash color='#C4D2ED'>
    <image image='zapp' deltaleft='8' deltatop='8'/>
    <label align='Client' bevelouter='Lowered' autoleft='true' deltaleft='8' width='-8' height='-8' gradienttype='FullVertical' color='#C4D2ED' colorto='#7E98CB'><![CDATA[<b>&AppTitle;</b><br><br>
Version &AppVersion;<br><br>
by &AppAuthor;]]></label>
  </splash>
  <action name='FileOpen' action='_FileOpen'>
    main.Caption = "Not Connected"
    if core.ExecuteAction then
      DBConn.Filename = FileOpen.Dialog.Filename
      DBSource.Active = true
      main.Caption = "Map database: " &amp; DBConn.Filename
    end if
  </action>
  <script>
    FileOpen.Dialog.Filter = "Map Files (*.mdb)|*.mdb"
    FileOpen.Dialog.Title = "Open Map Database"
  </script>
  <toolbar name='mainmenu'>
    <menu caption='&amp;File'>
      <item action='FileOpen'/>
      <item action='_FileExit'/>
    </menu>
    <menu caption='&amp;Edit'>
      <item action='_EditCut'/>
      <item action='_EditCopy'/>
      <item action='_EditPaste'/>
    </menu>
    <menu caption='&amp;View'>
      <item caption='Normal' script='core.themeindex = -1'/>
      <item caption='Aqua' script='core.theme = "aqua"'/>
      <item action='_ThemeSelect'/>
    </menu>
    <menu caption='&amp;Help'>
      <item caption='&amp;About' script='core.execwindow( "About")'/>
    </menu>
  </toolbar>
  <toolbar name='maintoolbar'>
    <navigator/>
  </toolbar>
  <window name='main' caption='&AppTitle;' width="640" height="480">
    <connection name='DBConn'>
      <query name='DBQuery' text='ObjectTbl'>
        <datasource name='DBSource'/>
      </query>
    </connection>
    <dock position='top'>
      <toolbar name='mainmenu'/>
      <toolbar name='maintoolbar'/>
    </dock>
    <panel align='top' height='22'>
      <combo.lookup name='Zone' align='left' lookuptable='ZoneTbl' lookupfield='ZoneID' displayfield='Name' Hint='Zone filter' events='true'>
        <script event='onchange'>
          if (Zone.Value = -1) then
            if (DBQuery.Filtered) then
              DBQuery.Filter = FilterStr.Text
            end if
          else
            if (FilterStr.Text = "") then
              DBQuery.Filter = "ZoneID = " &amp; Zone.Value
              DBQuery.Filtered = true
            else
              DBQuery.Filter = FilterStr.Text &amp; " AND ZoneID = " &amp; Zone.Value
              DBQuery.Filtered = true
            end if 
          end if
        </script>
      </combo.lookup>
      <button caption='Filter' image='filter' align='right'>
        if FilterStr.Text = "" then
          DBQuery.Filtered = false
        else
          DBQuery.Filter = FilterStr.Text
          DBQuery.Filtered = true
        end if
      </button>
      <button caption='Clear' image='cancel' align='right'>
        DBQuery.Filtered = false
        DBQuery.Filter = ""
        Zone.Value = -1
      </button>
      <edit name='FilterStr' caption='Filter:' align='client' deltaleft='40'/>
    </panel>
    <grid align='left' datasource='DBSource' width='200'>
      <column caption='Name' field='Name'/>
    </grid>
    <splitter/>
    <panel align='client'>
      <label caption='ID:' left='21' top='2'/>
        <label field='Objid' left='40' top='2'/>
        <checkbox caption='Enabled' field='Enabled' left='90' top='2'/>
        <combo.lookup caption='Zone:' left='220' top='2' fullwidth='true' field='ZoneID' lookuptable='ZoneTbl' lookupfield='ZoneID' displayfield='Name'/>
      <edit caption='Name:' field='name' left='40' top='26' fullwidth='true'/>
      <spinedit caption='X:' field='X' left='40' top='50'/>
      <spinedit caption='Y:' field='Y' left='130' top='50'/>
      <spinedit caption='Z:' field='Z' left='220' top='50'/>
      <combobox caption='Label:' field='LabelDir' left='330' top='50' fullwidth='true' itemlist='North|NE|East|SE|South|SW|West|NW|Up|Down|Other|None'/>
      <memo align='client' field='Desc' deltatop='74' wordwrap='false'/>
    </panel>
    <statusbar name='Status' align='bottom'/>
    <script>
    </script>
  </window>
  &AboutBox;
</zapp>
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net