on 05-16-2008 1:40 AM
Hello All:
Have a UI add-on that have menu button that opens a user form... It works great first time you click it, and everything the buttons text combo...etc works fine. But when you click cancel ITEMUID = "2" The menu wouldn't pop up again. I try-catch the entire thing couldn't find where it failed. BTW, this is still in debug mode. I think the thing is dead, because it doesn't recognized any other events or action after it is closed. But I am not sure why!
I have my
static void Main()
{
try
{
AutoSalesOrder oload = new AutoSalesOrder();
System.Windows.Forms.Application.Run();
}
catch (Exception ex)
{
Global.oapplication.MessageBox(ex.Message.ToString(), 1, "OK", "", "");
}
}
// Event handling
Global.oapplication.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
Global.oapplication.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
Global.oapplication.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
Even put in these things to make sure I closed it properly...
case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
BubbleEvent = true;
Global.oapplication.StatusBar.SetText("Form Closed", SAPbouiCOM.BoMessageTime.bmt_Short,
(SAPbouiCOM.BoStatusBarMessageType.smt_None));
break;
case SAPbouiCOM.BoEventTypes.et_CLICK:
if (pVal.ItemUID == "2" && pVal.BeforeAction == false)
{
BubbleEvent = false;
Global.oapplication.Forms.Item(FormUID).Close();
}
break;
Still not sure what's wrong with it..
Edited by: Bo Peng on May 16, 2008 2:40 AM
Edited by: Bo Peng on May 16, 2008 2:58 AM
Anyone??? It's kind of urgent situation!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found out what's wrong, and really really embarrased at this point!
To get lazy, I put
if (FormUID == "Zautoso")
{
Global.oForm = Global.oapplication.Forms.Item("Zautoso"); ---->>
switch (pVal.EventType)
{
case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
if ((pVal.ItemUID == "runreport") & (pVal.BeforeAction == false))
{
.......
}
}
}
on top of all the event swtichs and if / else if statement. Of course there are multiple itemevent go after this at the time of close. So first itemevent look at that statement and can't find form (because form already closed).. and output the error...
I am curious as why the debug stayed on the Global.ofrm.close() statement instead of above statement!!
Edited by: Bo Peng on May 16, 2008 3:01 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Petr:
I have no problem open the form, and do anything with the form! The problem only happens when I close the form!
At the time I close the form, I still have valid FormUID. the statement before oform.close() I can still use oform to do something with the form! But as soon as it get to .close() it says invalid form...
BTW, this is SBO2005A SDK..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Appearantly there is a unhandled error
case SAPbouiCOM.BoEventTypes.et_CLICK:
if (pVal.ItemUID == "cancel" && pVal.BeforeAction == true)
{
BubbleEvent = false;
try
{
Global.oapplication.Forms.Item(FormUID).Close();
}
catch(Exception ex)
{
}
}
break;
It says "invalid form" but I check the form.. it is still my form's UID. and form is still up there, as I am using beforeaction = true there. I even changed the button UID from "2" to "cancel"
See the below attached picture... It's the evenlog I ran.. Before it try to close the form. it went and et_validate whole bunch of stuff.. and then when it time to close error pop up says FORM- invalid form..
Can someone help?
<a href="http://imageshack.us">[IMG]http://img341.imageshack.us/img341/9265/resultpicgj7.jpg[/IMG]</a>
Edited by: Bo Peng on May 16, 2008 3:29 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
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.