Rank: Advanced Member
Groups: Approved
Joined: 9/13/2018(UTC) Posts: 54 Thanks: 18 times Was thanked: 18 time(s) in 13 post(s)
|
Hi I started to be interested in it for some time and have made several attempts but without success and I would like to ask if S + Net allows you to create your own window, for example a window similar to "MessegeBox" but with the CheckBox option?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,360 Location: Tampa, FL Thanks: 28 times Was thanked: 421 time(s) in 357 post(s)
|
No, that would really be a bit complicated. It's very easy to do this yourself, though! Just make a plug-in (someone other than me needs to at some point!) - Download Visual Studio 2019 Community Edition - New Project (.Net Framework Class Library, select 4.6.2 as target, just to match S+) - Add a Form (YuichiForm) to the solution and drag-and-drop some controls on it - Rename Class1 to YuichiFormLibrary - Add some public properties - In the YuichiForm() constructor method, show the form - Compile, take the DLL and add it in S+, reload Obviously you'll want to wire some things up in the form to handle things, and perhaps return a value, which is returned, etc. Here's a quick project I made you can use as an example: https://www.strokesplus.net/files/YuichiFormLibrary.zipEdited by user Thursday, June 13, 2019 7:53:37 PM(UTC)
| Reason: Not specified
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 9/13/2018(UTC) Posts: 54 Thanks: 18 times Was thanked: 18 time(s) in 13 post(s)
|
Oh, thanks man. This is the answer I need.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,360 Location: Tampa, FL Thanks: 28 times Was thanked: 421 time(s) in 357 post(s)
|
Oh yeah, here's the sample script I used to test: Code:var form = new YuichiFormLibrary();
var isChecked = form.ShowForm(false);
sp.MessageBox(isChecked, "Check Value");
Edited by user Thursday, June 13, 2019 7:34:44 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,360 Location: Tampa, FL Thanks: 28 times Was thanked: 421 time(s) in 357 post(s)
|
Bah, I also forget to set the form's checkbox value on load (the parameter passed into ShowForm)...but you get the idea!
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,360 Location: Tampa, FL Thanks: 28 times Was thanked: 421 time(s) in 357 post(s)
|
I updated the download to have some new functionality, primarily just made a function to get the form itself and I changed the Modifier properties of the form controls to Public so they can be accessed outside of the form. https://www.strokesplus.net/files/YuichiFormLibrary.zipNote: Remove the plug-in first, then add the updated DLL plug-in before using the script below. So here's a more useful example of making a generic/reusable form: Code:var formLib = new YuichiFormLibrary();
var form = formLib.GetForm();
form.listBox1.Items.Add("Test Item 1");
form.listBox1.Items.Add("Test Item 2");
form.label1.Text = "This is a test";
form.button1.Text = "Click OK";
form.ShowDialog();
sp.MessageBox(form.listBox1.SelectedItem, "Selected Item");
sp.MessageBox(form.checkBox1.Checked, "Checkbox State");
It doesn't have any error handling, like if you close the form without selecting an item in the list box, you get an error, for example. But this is just to give you some ideas. You could also make use of the various containers, like flow/table/split layouts etc. You could make all of the controls Public and be able to set things in the script, like checkBox1.Visible = false; to hide it if you don't need it for a certain purpose, etc. Could also make the YuichiFormLibrary a static class so you don't need to instantiate it to get a form, so it would be more like var form = new YuichiFormLibrary.GetForm();The possibilities are endless!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close