Buit user Interface template using C#

Any template questions or comments or suggestions

Buit user Interface template using C#

Postby oneforall2012 on Tue Jul 18, 2006 8:28 am

Hi there
i am trying to built a user interface using C# ,so i tried to convert a VB Script code to C# and the code was this :
Code: Select all
public class GeneratedGui : DotNetScriptGui
   public GeneratedGui(ZeusContext context) : base(context) {}

   // The User Interface Entry Point
   GuiListBox lstTables;
   public override void Setup()
      ui.Title = \"Generate C# dOOdads\";
      ui.Width  = 330;
      ui.Height = 480;
      string sOutputPath;
      sOutputPath = \"\";
         sOutputPath =input[\"defaultOutputPath\"].ToString();
      ui.AddLabel(\"lblPath\", \"Output file path: \",\"Select the output path.\");
      ui.AddTextBox(\"txtPath\", sOutputPath,\"Select the Output Path.\");
      ui.AddFilePicker(\"btnPath\", \"Select Path\", \"Select the Output Path.\", \"txtPath\", true);
      ui.AddLabel(\"lblNamespace\", \"Namespace: \",  \"Provide your objects namespace.\");
      ui.AddTextBox(\"txtNamespace\", \"Your.Namespace\", \"Provide your objects namespace.\");
      // List Databases in a ComboBox
      ui.AddLabel(\"lblDatabases\", \"Select a database:\", \"Select a database in the dropdown below.\");
      GuiComboBox cmbDatabases = ui.AddComboBox(\"cmbDatabase\", \"Select a database.\");
      // List Tables in a listbox
      ui.AddLabel(\"lblTables\", \"Select tables:\", \"Select tables from the listbox below.\");
      lstTables = ui.AddListBox (\"lstTables\", \"Select tables:\");
      //lstTables.IsMultiSelect = false
      lstTables.Height = 120;
      GuiCheckBox prefix = ui.AddCheckBox(\"prefix\", \"Prefix the 'File' with an underscore?\", false, \"If checked, the file on disk will begin with an underscore\");
      GuiCheckBox trimName = ui.AddCheckBox(\"trimName\", \"Trim spaces from output filename?\", false, \"If checked, the file on disk will have spaces trimmed from the name.\");
      if(MyMeta.DriverString == \"FIREBIRD\")
         ui.Height = ui.Height + 20;
         GuiCheckBox chk = ui.AddCheckBox(\"ckDialect3\", \"DIALECT 3\", false, \"If checked, the stored procedure will use dialect 3 syntax\");
         chk.ForeColor = \"red\";
      //cmbDatabases.AttachEvent(\"onchange\", \"cmbDatabases_onchange\");
      ui.ShowGui = true;
   private void setupDatabaseDropdown(GuiComboBox cmbDatabases)
   private void bindTables(string sDatabase)
   //Event Handler
   //Sub cmbDatabases_onchange(control)
      //Set cmbDatabases = ui.item(\"cmbDatabase\")
      //bindTables cmbDatabases.SelectedText
   //End Sub

but when i try to execute this code i got this error:




Void EngineExecuteGuiCode(Zeus.IZeusCodeSegment, Zeus.IZeusContext)
Merssage :

Object reference not set to an instance of an object.

at Zeus.DotNetScript.DotNetScriptExecutioner.EngineExecuteGuiCode(IZeusCodeSegment segment, IZeusContext context)
at Zeus.ZeusExecutioner.ExecuteGuiCode(IZeusCodeSegment segment, IZeusContext context)
at Zeus.ZeusExecutioner.ExecuteCodeSegment(IZeusCodeSegment segment, IZeusContext context)
at Zeus.ZeusCodeSegment.Execute(IZeusContext context)
at MyGeneration.TemplateForms.TemplateEditor._Execute()

any1 have any ideas ,please reply me
coz all template smaples has wrietten in JScript and VBScrip
thnx in Advance
Posts: 3
Joined: Tue Jul 18, 2006 8:00 am

Postby dnparsons on Tue Jul 18, 2006 12:12 pm

Under Tutorials, you should find a C# tutorial. Chapter 2 shows how to use pure Windows Forms code in the template interface code.

For an example of using the zeus controls in C# template interface code, see the TableRelation HowTo (C#) template in the DnpUtilsarchive. It has code similar to the above in C#, e.g.; setupDatabaseDropdown and bindTables.

Rather than download the template from the archive, the best way to get it is by clicking on the Globe icon from the Template Browser. Navigate to the DNP.PluginExamples folder, right-click the template, and Save.
David Neal Parsons
User avatar
Lieutenant General
Posts: 292
Joined: Sun Jan 09, 2005 2:10 pm
Location: Miami, Florida

Return to General Template Questions/Comments

Who is online

Users browsing this forum: No registered users and 1 guest