Aus einer Combobox heraus andere Masken aufrufen
Sebastian Schweer
Hallo zusammen,ich habe folgendes Problem.
Gegeben ist eine per C# Code selbstgebaute Combobox die verschiedene Werte enthält. Nun soll aber an letzter Stelle ein Eintrag "Neuer Wert" erscheinen, der ein Menü aufruft, in dem man neue Werte eintragen kann.
Beispiel:
Combobox:
- Wert 1
- Wert 2
- Wert 3
- Neuer Wert
Sobald nun "Neuer Wert" ausgewählt wird, soll das Menü xy erscheinen.
Ich habe folgendes probiert:
ComboBox.ValidValues.Add(SwissAddonFramework.UI.Components.MenuItem.GetFromUID("2050").Activate());
Leider funktioniert das nicht. Kann mir jemand helfen oder einen Tipp geben?
Vielen Dank,
Sebastian
Paolo Manfrin
Hi Sebastian,you cannot delclare the behaviour in the ValidValues list.
The right behaviour is the following:
Form form = Form.CreateNewForm("CUS_1", SwissAddonFramework.Utils.UniqueStringGenerator.Next());
...
ComboBox c = ComboBox.CreateNew("C1");
// set the other combobox properties here (position)
form.AddItem(c);
form.Load();
c.ValidValues.Add("1", "Wert1");
c.ValidValues.Add("2", "Wert2");
c.ValidValues.Add("3", "Neuer Wert");
// add the event handler
SwissAddonFramework.UI.EventHandling.ItemEvents.ComboSelectEventHandler del = null;
del = delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.ComboSelected ev)
{
//MessageBox.Show(c.Selected.Description, "OK");
if (c.Selected.Description== "Neuer Wert")
SwissAddonFramework.UI.Components.MenuItem.GetFromUID("2050").Activate();
};
c.AddHandler_Select(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, null, del);
hth
Kind Regards,
paolo
Sebastian Schweer
Hallo Paolo,thanks a lot. That Works :D
Kind regards,
Sebastian
0
Please sign in to leave a comment.
Comments
0 comments