Input from User
Sebastian Schweer
Hallo,is there any chance to receive an input string from from user?
I mean something like the Messagebox.
A Popup shown up, and, for example, the user type in an item code and then the corresponding item will open.
Something like this, that the User get a Pop-Up and can type a string which i can work with.
Something like "Interaction.InputBox(...)" which exists in Visual Basic, but for C#.
Does anybody have a code-example or an idea for this?
Thanks a lot,
Sebastian
Manuel Marhold
Hi Sebastian,you can use the default InputBox from the .Net-Framework, but it's not in the SBO design.
Or you crate a new form an catch the pressing on "OK" an then do your stuff. Take a look at "coresuite framework" for this.
Sebastian Schweer
Hallo Manuel,thanks for answering.
But have you a code-example for the Input Box in C# or the name of the method?
In the C# API i can't find anything. And in the www i only find an InputBox for Visual Basic.
I try to a call to VisualBasic form C#, but that crashed in Coresuit:
Microst.VisualBasic.Interaction.InputBox(..)
Best regards,
Sebastian
Manuel Marhold
Hi,Microsoft.VisualBasic.Interaction.InputBox(..)
you wrote Microst instead of Microsoft
Sebastian Schweer
ups,sorry ^^
But that i do only in this example, where i just worde it short bevore quitting time.
In Coresuite i realy wrote "Microsoft" ;)
... and that will not work :(
Manuel Marhold
Hi Sebastian,so I don't know why coresuite crashes.
David Emmenegger
Here is a generic way how to create an inputbox-like form with C#:try
{
Form f = Form.CreateNewForm("F", SwissAddonFramework.Utils.UniqueStringGenerator.Next());
TextEdit txt = TextEdit.CreateNew("T1");
txt.Top = txt.Top + 5;
Button btn = Button.CreateNew("B1");
btn.SetPosition(txt);
btn.Top = btn.Top + btn.Height + 5;
btn.Value = "OK";
f.AddItem(txt);
f.AddItem(btn);
f.Load();
f.Update();
SwissAddonFramework.UI.EventHandling.ItemEvents.ItemPressedEventHandler ev = null;
ev = delegate (SwissAddonFramework.UI.EventHandling.ItemEvents.ItemPressed e)
{
StatusBar.WriteSucess(txt.Value);
};
btn.AddHandler_ItemPressed(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, null, ev);
}
catch (Exception ex)
{
StatusBar.WriteError(ex.Message);
}
0
Please sign in to leave a comment.
Comments
0 comments