UI Question

  • kingspawn

    kingspawn - 2007-10-16

    I am fairly new to MyGeneration and have a question regarding the user interface part of a script. I am trying to figure out how to do two things within the interface code:

    1. How do I setup a multi-line text box?

    2. I need a UI window that is fairly large and able to handle more then one column worth of inputs. I can control the size of the window but do not see how to set the position of the input controls within that window.

    Also, if you could point me at documentation for the user interface (or samples that do this) I can probably figure this out myself but I have not found anything helpful yet.

    Thanks in advance for your help.


    • readOnlyChild

      readOnlyChild - 2007-10-17

      here's some code to get you started... basically, you can set properties Top, Width and Left on UI components just as in a windows form...
      -- just comment the .AttachEvent line and you can see the UI in a new template paste-ing the following

      // start
      ui.Width  = 540;
              //ui.Height = 500;
              int lblWidth = 120;
              int col1Left = 130;
              int col1Width= 190;
              int col2Left = 340;
              int col2Width= 160;
              GuiLabel   lblNamespace = ui.AddLabel("lblNamespace", "Namespace: ", "");
              lblNamespace.Width = lblWidth;
              GuiTextBox txtNamespace = ui.AddTextBox("txtNamespace", "bo", "Type desired namespace");
              txtNamespace.Top = lblNamespace.Top;
              txtNamespace.Left = col1Left;
              txtNamespace.Width = col1Width;
              GuiCheckBox chkReadOnly = ui.AddCheckBox("chkReadOnly", "Gen as ReadOnly", false, "");
              chkReadOnly.Top = lblNamespace.Top+1;
              chkReadOnly.Left = col2Left;
              chkReadOnly.Width = col2Width;
              GuiLabel   lblTable = ui.AddLabel("lblTable", "Table: ", "");
              lblTable.Width = lblWidth;
              GuiComboBox cbxTables = ui.AddComboBox("cbxTables", "Select Table:");
              cbxTables.Top = lblTable.Top;
              cbxTables.Left = col1Left;
              cbxTables.Width = col1Width;
                ITables tables = MyMeta.Databases[0].Tables;
                  foreach(ITable tbl in tables){
                      cbxTables[tbl.Name] = tbl.Name;
              cbxTables.AttachEvent("onchange", "tableSelected");
              //GuiCheckBox chkEditRules = ui.AddCheckBox("chkEditRules", "Gen Edit Rules w/xpiMsgs", false, "");
              //chkEditRules.Top = chkReadOnly.Top+42;
              //chkEditRules.Left = col2Left;
              //chkEditRules.Width = col2Width;

              //GuiLabel lblParent = ui.AddLabel("lblParent", "Parent:", "clase padre");
              //lblParent.Width = lblWidth;
              //GuiTextBox txtParent = ui.AddTextBox("txtParent", "", "");
              //txtParent.Top = lblParent.Top;
              //txtParent.Left = col1Left;
              //txtParent.Width = col1Width;
              GuiLabel   lblNVL = ui.AddLabel("lblNVL", "Require NameValueList Methods: ", "");
              GuiCheckBoxList chkFields = ui.AddCheckBoxList("chkFields", "");
              chkFields.Height = 160;
              chkFields.Left = col1Left;
              chkFields.Width = col1Width;
              GuiLabel lblChildCollections = ui.AddLabel("lblChildCollections", "Child Collection Objects: (ordered as in SP resultsets)", "");
              GuiTextBox txtChildCollections = ui.AddTextBox("txtChildCollections", "", "child collection objects, comma delimited");
              GuiLabel lblToStringProp = ui.AddLabel("lblToStringProp", "Property for ToString():", "");
              lblToStringProp.Width = lblWidth;
              GuiTextBox txtToStringProp = ui.AddTextBox("txtToStringProp", "", "type property for tostring() override");
              txtToStringProp.Top = lblToStringProp.Top;
              txtToStringProp.Left = col1Left;
              txtToStringProp.Width = col1Width;
              GuiLabel lblAppKey = ui.AddLabel("lblAppKey", "Application Key", "");
              lblAppKey.Width = lblWidth;
              GuiTextBox txtAppKey = ui.AddTextBox("txtAppKey", "", "Application Key");
              txtAppKey.Top = lblAppKey.Top;
              txtAppKey.Left = col1Left;
              txtAppKey.Width = col1Width;
              ui.Top = 700;
              ui.ShowGui = true;
      // end


      about the multiline textbox, i dont know that yet...

    • kingspawn

      kingspawn - 2007-10-17

      Thanks so much for the feedback and sample code.

      This takes me a step closer.

    • Anonymous - 2007-10-22

      I think the new intellisense will make your life easier here. It's not 100% yet, but I expect to get it working well enough to help people develop their templates.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks