08-29-2011 11:02 AM
First of all, THANK YOU to all who have replied to my messages. I am rapidly learning how to program Plugins and their Methods and Events.
I wonder if it is possible to open a new Form on top of ACT! when I click on a Button. I would like to create form using Design tools and not programatically, if possible.
Any suggestions? Sample code? How would I call (and release) the Form?
09-04-2011 03:26 PM
OK ... I got it.
I need to create a new Instance of an existing form, then use that Instance.
I have an existing Form called "Form1". I can open and use the Form in a Plugin. Here is the code:
Dim aform As New Form1()
I plan on using this Form to create and manage settings for my Plugin.
Thanks - this opens up a whole new set of possibilities>
08-30-2011 07:44 AM
Yes, this is absolutely possible. How you choose to launch your form is totally up to you, you could have a menu item, a button on the toolbar or have it fire based on some event.
From within the API we have a method LoadSDIView, which accepts a windows form as it's only parameter and launches it as if it were a view in Act, it should be noted however that it is not a new view so it isn't accessible in the same ways a view would be. Alternatively, via .Net we can use System.Diagnostics.Process.Start, this will start a process, you can create a seperate executable and launch it this way.
There are definetly alternatives to this.
08-30-2011 09:55 AM
Do you have any Code to show in a Plugin how to open a Form, and how to close the Form?
I am familiar with running an external program to do this. What is the best way to pass Parameters using this method?
08-30-2011 11:15 AM
I used the sample plugin and added a new method that fires when the new menu item is selected:
private void OpenForm(string str)
I prefer this over LoadSDIView, but incase you wanted to try it:
Form form = new Form();
As I mentioned earlier, this opens your form in the application as if it were a new view, but the view you changed from doesn't get disposed. So if I call this while on the contact detail screen, Act will continue to think I'm on the contact detail view even though my form is showing.
To dispose of it or move away from it, I added buttons to the form navigate to another view:
private void btnListView_Click(object sender, EventArgs e)
09-02-2011 06:23 AM
Thanks, Jim, for the reply.
OK...I can open a new form using your code:
Form form = new Form();
Is it possible to design a Form in vb.Net that can be opened in the Plugin?
// I have a form designed in vb.NET named FormTest
Form formA = new Form() formtest;
I don't know if this is possible - thanks for any suggestions.
09-02-2011 07:37 AM
Absolutely, there are a lot of options for how, were you wanting to open the form from a menu item/toolbar icon? Or based on some event?
09-02-2011 09:41 AM - edited 09-02-2011 09:41 AM
I'd like to open a form using a Button.
Once I understand how to open a Form, I can code the event to a Field.
My Form is called FormTest.
My UserControl (TabPage) is called UserControlTest.
I am running the UserControl in a TabPage Plugin in ACT 2011.
I would love to see code (either VB or C#) that would open a Form from a UserControl, and then close the Form and give the focus back to the UserControl.
09-02-2011 10:15 AM - edited 09-02-2011 10:18 AM
I posted an example VB VS 2008 example plugin which adds a tab to the Contact Details view. This tba holds a user control. On the user control there is a button named Button1.
In the code change the Button1_Click event
Dim MyForm as new MyForm()
Hope this helps.
-- Jim Durkin
09-02-2011 10:22 AM - edited 09-02-2011 10:23 AM
Again, thanks for the reply.
I did look at your example to open a brand new Form within a Plugin.
What I'd like to do is to open a Form (with a variety of Controls) that I designed in vb.net before I compiled the DLL. That way, I can layout the Form to be opened through the designer instead of creating a new one on the fly.