on 2024 Mar 27 4:40 AM
Hi All,
I must be missing something simple.
I would just like to confirm the behavior of BubbleEvent Property in SAPB1 UI API
Is the above correct?
If it is correct, how can i stop the EditText after validate?
Regards
Edy
Request clarification before answering.
Hi edy_simon,
Check SAP Note 1832907 for the same.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ANKIT_CHAUHAN ,
No particular thing to achieve, just wondering if this is a bug or by design.
AFAIK, the BubbleEvent property should prevent the system event from bubbling up to the next event.
For example, in a button BeforeItemPressed event, if I set the BubbleEvent = false, the UI API will not raise the AfterItemPressed event.
However, in a grid BeforeValidate event, even when setting the BubbleEvent = false, UI API still raise the AfterValidate event.
Below is the code i use to test
internal class Program
{
static SAPbouiCOM.Application app;
static string formUID, grid1UID, grid2UID;
[STAThread]
static void Main()
{
try
{
SAPbouiCOM.SboGuiApi oGUI = new SAPbouiCOM.SboGuiApi();
oGUI.Connect("0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056");
app = oGUI.GetApplication();
app.ItemEvent += App_ItemEvent;
//Create 1 form with 1 grid
var fcp = app.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams) as SAPbouiCOM.FormCreationParams;
string sql1 = "SELECT CAST('A' AS NVARCHAR(1)) InvDesc, '1' LineIdx, '0' LineNum UNION ALL SELECT 'A', '2', '1' UNION ALL SELECT 'A', '1', '2' UNION ALL SELECT 'A', '2', '2'";
var newForm = app.Forms.AddEx(fcp);
formUID = newForm.UniqueID;
newForm.Title = "Test Grid Validate";
newForm.Width = 650;
newForm.Height = 750;
var dt = newForm.DataSources.DataTables.Add($"dt1");
dt.ExecuteQuery(sql1);
var grid = newForm.Items.Add($"grd1", SAPbouiCOM.BoFormItemTypes.it_GRID).Specific as SAPbouiCOM.Grid;
grid.Item.Top = 10;
grid.Item.Left = 10;
grid.Item.Width = 600;
grid.Item.Height = 300;
grid.DataTable = dt;
newForm.Visible = true;
System.Windows.Forms.Application.Run();
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
private static void App_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
try
{
if(FormUID == formUID && pVal.ItemUID == "grd1" && pVal.ColUID=="LineNum" && pVal.EventType== BoEventTypes.et_VALIDATE && pVal.BeforeAction)
{
//Before Action
app.StatusBar.SetText("Before Action triggered");
BubbleEvent = false;
return;
}
if (FormUID == formUID && pVal.ItemUID == "grd1" && pVal.ColUID == "LineNum" && pVal.EventType == BoEventTypes.et_VALIDATE && !pVal.BeforeAction)
{
//After Action
app.StatusBar.SetText("After Action triggered");
}
}
catch (Exception Ex)
{
BubbleEvent = false;
MessageBox.Show(Ex.Message);
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
122 | |
8 | |
8 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.