UI for an XML File.
UI for an XML File.
UI for an XML File.
UI for an XML File.
UI for an XML File.
UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File.
UI for an XML File. UI for an XML File.
UI for an XML File.
Go Back  Xtreme Visual Basic Talk > > > UI for an XML File.


Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2013, 01:42 AM
timehacker11 timehacker11 is offline
Newcomer
 
Join Date: Apr 2013
Posts: 5
Default UI for an XML File.


I am creating an app that edits and generates a specific type of XML file. I don't know how to handle the UI.

This is the markup of the type of XML file I'm working with. (Note that the variables change as my app also generates these types of files.

Code:
<wiidisc version="1">
<id game="RMC" />

<options>

<section name="Mario Kart Wii">

<option name="Course Textures">
<choice name="Enabled!">
<patch id="Textures" />
</choice>
</option>

<option name="Text Hax">
<choice name="Enabled!">
<patch id="BMG"/>
</choice>
</option>

<option name="Music"> 
<choice name="Enabled!">
<patch id="Music"/>
</choice>
</option>

<option name="Everything Else">
<choice name="Items, Icons, Etc">
<patch id="Other"/>
</choice>
</option>

</section>

</options>

<patch id="Textures">
<folder disc="/Race/Course" external="/mkwii/Courses"/>
</patch>

<patch id="BMG">
<folder disc="/Scene/UI" external="/mkwii/Text"/>
</patch>

<patch id="Music">
<file disc="/sound/revo_kart.brsar" external="/mkwii/Music/revo_kart.brsar"/>
<file disc="/sound/strm/n_maple_n.brstm" external="/mkwii/Music/n_maple_n.brstm"/>
<file disc="/sound/strm/n_maple_F.brstm" external="/mkwii/Music/n_maple_F.brstm"/>
</patch>

<patch id="Other">
<file disc="/Race/Common.szs" external="/mkwii/Else/Common.szs"/>
</patch>

</wiidisc>
Reply With Quote
  #2  
Old 04-28-2013, 09:30 AM
AtmaWeapon's Avatar
AtmaWeaponUI for an XML File. AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I don't understand the question. What does "I don't know how to handle the UI" mean? If it means "I've never made a VB app before in my life" then I'm not sure a forum is the appropriate place for help; you should find a book and spend a month or two (yes, a month or two) creating small applications to get the hang of it. If it's "I don't know what a sensible UI would look like for this, read on."

My favorite advice is, "There isn't much difference between knowing what you are doing and pretending you know what you're doing, so pretend you know what you're doing and get something done." This is a fancy way of saying "practice makes perfect". Try a few UIs. Do they work? If so, great! If you can't think of a way to make them better, you're done. UI design is sort of an art, but there's some guidelines that can be picked up. Failure is more useful than success when you are a beginner.

All I know about the file format is "this is one valid file". It is more useful to describe how each portion can change, and how you expect the user to edit them. Without knowledge of how the file changes, my answer is "Your UI should be a button that saves the file you pasted."

Here's what my psychic powers tell me will be more helpful to you:
  • The stuff in the <options> tag is likely to be there every time. You might opt to group those controls together with a GroupBox. Group boxes provide a visual indicator that some controls are related to each other. (<section> is another possible group box, as is <options>.
  • Individual <option> sections are other candidates for a GroupBox; since there's many of them it will help the eye figure out which controls go with which particular option. Yes, you can put group boxes inside another group box.
  • The <choice> elements seem to be text values, and each set of <option> tags seems to have different values for them. A TextBox would work. But if the available valid options are limited and known ahead of time, you might consider a selection control like ListBox or ComboBox.
  • It feels like the correct value for <patch> will always be the same underneath a given <option> tag. This means there likely /shouldn't/ be a control for this tag. Don't let the user change things that shouldn't change, or even hint that it's possible.
  • Similarly, the later <patch> sections (outside the <options> tag, whoever designed this designed their XML poorly in my opinion) seem like some portions (the "disc" attributes) will always be fixed while other portions (the "external" attribute) need to be edited. There's also a sense that the number of File or Folder elements can change. This is a more complex UI and is best expressed via a UserControl, as in one of its forms it involves 2-5 buttons, at least 2 text boxes, and a ListView control all working together for the purpose of creating a value.

How do you turn all of these control values into an XML file? I'd start with making classes that represent each section of the XML. For example:
Code:
Public Class OptionSection
    Public Property Choice As String
    Public Property PatchId As String
    Public Property Name As String
End Class
Note that each of those properties corresponds to one of the values that must be written within an <option> tag. The next step is to write code that takes collections of these objects and generates valid XML based on them. Finally, design your UI and write code that (likely in response to a "save" button) creates these objects based on the controls' values, then sends the objects to the code that writes XML.

Aside:
Many beginners skip the "make a class" step and write code that reads values from controls as it is writing the XML. This is a bad habit and you shouldn't let yourself get into it. It makes it hard to change the UI later. It makes it harder for forum people to help you because they have to recreate your UI before they can run your code to test it. Further, controls tend to work with String values and that means embedding (sometimes) complex conversion from String to more appropriate types in the middle of code that should be doing something else.

Here's how code in either style reads:
(with classes)
Create an OptionSection based on the value in cmbEverythingElse. Now write XML for an <option> section using the OptionSection's properties.

(without)
Create an <option> tag and set its "name" attribute to gboEverythingElse.Text. Add a <choice> tag to it and set its "name" attribute to cmbEverythingElse.SelectedItem.ToString(). Add a <patch> element with its "id" property set to _patchIdEverythingElse.

The /lines of code/ required for either option is nearly the same. But /reading/ those lines is easier if done the "hard" way.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 05-03-2013, 04:44 PM
timehacker11 timehacker11 is offline
Newcomer
 
Join Date: Apr 2013
Posts: 5
Default

Thanks for the very detailed answer.

I'm going to use a combination of controls; TabControls, DataGridView's, along with GroupBoxes.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
UI for an XML File.
UI for an XML File.
UI for an XML File. UI for an XML File.
UI for an XML File.
UI for an XML File.
UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File. UI for an XML File.
UI for an XML File.
UI for an XML File.
 
UI for an XML File.
UI for an XML File.
 
-->