Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add Button

Accepted Solution Solved
New Member
Posts: 5
Country: France
Accepted Solution

Add Button

hi all,

 

i'm newbie ACT! developer, if someone knows how to add a button on ContactDetailView near phone number field, im programming a plug-in  to make call from ACT directly and i need to put 2 button to start up the call as there are 2 phone fields.

 

thanks


Accepted Solutions
Solution
Accepted by topic author dhaouh
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 42
Country: Germany

Re: Add Button

Hi,

to add the button near the phone fields, you'll have to write an Act! Tool, not a PlugIn.

Then you can place this tool (a button) onto the layout with the contact layout editor.

 

If you write a Tool, it's .dll File has to be placed in the "C:\Program Files (x86)\ACT\Act for Windows\Tools" folder

 

The Code would look like this:

 

namespace ActButtonControl
{
  [Act.Shared.ComponentModel.CustomControl(true)]
  class TheButton : System.Windows.Forms.Button
  {
    protected override void OnClick(System.EventArgs e)
    {
      //Your code here, you can access the current contact via:
      Act.UI.ActApplication.Instance.ApplicationState.CurrentContact
    }
  }
}

 

After you placed the .dll in the Act-Tools folder you have to start Act, open the Layout-Designer, right-click in the toolbox to make your button-control visible and thus draggable onto the layout

View solution in original post


All Replies
New Member
Posts: 5
Country: France

Re: Add Button

actually im using this code to add a button on "costum" CommandBarCollection. but it is not my goal need absolutly to add my button near the phone fields.

 

Act.UI.Core.CommandBar _Bar;
if (Act_App.Explorer.CommandBarCollection["costum"] == null)
{
_Bar = Act_App.Explorer.CommandBarCollection.Add("costum", Act.UI.Core.CommandBarType.Toolbar);
Act_App.Explorer.CommandBarCollection.Add(_Bar, true);
myBar.CanUndock = true;
Act.UI.Core.CommandBarButton btnCall1 = new Act.UI.Core.CommandBarButton("Call", "Call Button1", null, "ConverTec.MenuToolbar.btnCall1", Resource1.Image1, Resource1.Image1);
theApp.RegisterCommand("ConverTec.MenuToolbar.btnCall1", new Act.UI.CommandHandler(H), Act.UI.RegisterType.Shell);
btnCall1.DisplayStyle = Act.UI.Core.CommandBarControl.ItemDisplayStyle.ImageAndText;
_Bar.ControlCollection.Add(btnCall1);


}

Solution
Accepted by topic author dhaouh
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 42
Country: Germany

Re: Add Button

Hi,

to add the button near the phone fields, you'll have to write an Act! Tool, not a PlugIn.

Then you can place this tool (a button) onto the layout with the contact layout editor.

 

If you write a Tool, it's .dll File has to be placed in the "C:\Program Files (x86)\ACT\Act for Windows\Tools" folder

 

The Code would look like this:

 

namespace ActButtonControl
{
  [Act.Shared.ComponentModel.CustomControl(true)]
  class TheButton : System.Windows.Forms.Button
  {
    protected override void OnClick(System.EventArgs e)
    {
      //Your code here, you can access the current contact via:
      Act.UI.ActApplication.Instance.ApplicationState.CurrentContact
    }
  }
}

 

After you placed the .dll in the Act-Tools folder you have to start Act, open the Layout-Designer, right-click in the toolbox to make your button-control visible and thus draggable onto the layout

New Member
Posts: 5
Country: France

Re: Add Button

thanks a lot for your reply! it was very helpful

New Member
Posts: 10
Country: USA

Re: Add Button

Which Act version enabled you to emmbed a control using the Designer?

With a Tool, how can you access the open Act Application object? Is there any refernce in formation you could point to in developing a Act! Tool?

Highlighted
Copper Contributor
Posts: 42
Country: Germany

Re: Add Button

[ Edited ]

I don't know, sice which version this is possible, I've started using this with Act! 2013 but I'd guess that it might be possible with Act! 2010 (Act! 12) as most commercial Add-Ins target Act!12-16, so I'd bet theese versions all share a very similar API.

 

How to access the currently running Act-Application can already be seen in my example (the only line in the Button-Click-Event-Handler).

More examples:

//accessing the currently running Act-Application-Instance:
Act.UI.ActApplication.Instance
//accessing the ActFramework of the currently running Act-Application
Act.UI.ActApplication.Instance.ActFramework
//accessing the current contact
Act.UI.ActApplication.Instance.ApplicationState.CurrentContact

There is an example in the ACT! SDK: "act!v17sdk\Content\Code Samples\ContactNameControl.zip"