Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Button Click Event

Hi,

i am trying to create a simple user form that will spawn off another form when a button is clicked. i managed to display the custom form without a problem. can anyone tell me as to how i can go on about capturing btn1's Click event so i can spawn off another custom form?

This is the code i have right now which displays a simple form with a button. i want to add an OnClick event for oButton.

////

SboGuiApi gui = new SboGuiApi();

gui.Connect("0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056");

Application SBO = gui.GetApplication(-1);

FormCreationParams fcp = (FormCreationParams)SBO.CreateObject(BoCreatableObjectType.cot_FormCreationParams);

fcp.UniqueID = "myUNIQUEID";

fcp.FormType = "myFORMTYPE";

fcp.BorderStyle = BoFormBorderStyle.fbs_Fixed;

Form oForm = SBO.Forms.AddEx(fcp);

Item oItem;

Button oButton;

oItem = oForm.Items.Add("btn1", BoFormItemTypes.it_BUTTON);

oButton = (Button)oItem.Specific;

oButton.Caption = "Button";

oItem.Top = 200;

oItem.Left = 20;

oItem.Width = 150;

oItem.Height = 30;

oForm.Visible = true;

////

ive tried adding item events but they arent picked up so im assuming im doing something wrong

Thanks for any help,

Matthew

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question