Create a Combo Button

Lars Mx

Hi, is it possible to create a combo button with coresuite framework? I searched in the UI.Components, but there is no Combo Button class.

Thanks for your help! Regards Lars

Paolo Manfrin

Hi Lars,

yes it is possible. Here the code snippet:





ComboBox c = ComboBox.CreateNew("COR_C1");

c.Left = 5;

c.Top = btnOK.Top + btnOK.Height + 5;

// combobox values after the load

c.ValidValues.Add("1", "Value 1");

c.ValidValues.Add("2", "Value 2");

c.ValidValues.Add("3", "Value 3");

SwissAddonFramework.UI.EventHandling.ItemEvents.ComboSelectEventHandler del = null;

del = delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.ComboSelected ev)

{

if (c.Selected.Value == "3")

SwissAddonFramework.UI.Dialogs.MessageBox.Show("Value 3 selected", "OK");

};

c.AddHandler_Select(ModeComponent.FormModes.ALL, null, del);





Hth,

paolo

Lars Mx

Thanks for your answer. But I mean a button not the box. Like the <You can also do> in the Business-Partner Masterdata.

Paolo Manfrin

Hi Lars,

you can use the function button, similar to the one we have in customize.

This functionality is provided by the framework.



In order to create an instance here you've the code snippet:





SwissAddonFramework.UI.FunctionButton.FunctionButton fb = new SwissAddonFramework.UI.FunctionButton.FunctionButton("my_funcButton", "My Function", "139", new SwissAddonFramework.UI.FunctionButton.FunctionButton.FunctionButtonDelegate(CallMe), "", false);

fb.Add();



// This event method is raised when the function button is pressed.

private static void CallMe(SwissAddonFramework.UI.FunctionButton.FunctionButtonEvent pVal)

{

SwissAddonFramework.Messaging.StatusBar.WriteSucess("My function button: Pressed");

}







If you need to create your own FunctionButton but is not so easy as you have to use the windows pointer and the rectangle class in order to show up the list of possible options.



hth

paolo

TodAnderson

How can i set the position of the COR_FUNC function button?
0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post