Question

I'm writing my own Rule Engine, I've looked at a couple that existed but I'm looking for something else which I couldn't find examples to. I'm looking for a similar application where I can dig into and learn how to do it.

Now, my question is REGARDLESS of the Rule Engine, more of a Form/Dynamic question, but if with your answer you can relate to what I eventually want to do, that would be great.

Regarding the UI, I'm using Visual Form and the I'd like it to be like this: http://i.imgur.com/5istREF.jpg

Now, once the user select on the final check box "And/Or" I want him to be able to enter another rule, exactly the same format as the first one. http://i.imgur.com/N588sjj.jpg

Now the user can basically do it as many times as he wants, so I'm looking for a way to dynamically handle it and create buttons/pannels or even using the same ones (but every time he can enter different values).

Like I've said if you know any similar application/code that I can look into, regardless of rule engine, that will help as well.

Eventually I will take all the fields that he entered and turn it into code.

Was it helpful?

Solution

If I understand you correctly, what you can do is make a controller of your own which is defined in an additional form and then you can add it to your main form as much as you want. You can define this new controller (meaning a new form) to hold only a single line of the comboBox and then add it to a location in your main form which is based on the location of the previous controller.

Here is an example which adds several control of a class called CNewControl to a tab called newControlsTab one after the other.

    int controlHeight = 0;
    foreach (CNewControl newControl in newControlList)
      {
        this.newControlsTab.Controls.Add(newControl );
        newControl.Dock = DockStyle.Top;
        newControl.Location = new System.Drawing.Point(40, 3 + controlHeight);
        controlHeight += newControl .Size.Height;
      }

You can of course change it to add your line only once when the user chooses the appropriate option in which a line should be added.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top