on 09-23-2008 4:03 AM
Hi,
can you help me on how to use ChooseFromList for UDO.
or do you have sample Code?
Please Help me.
Thanks...
This is the source code for a Tab CFL and Button CFL for a EditText box...
In XML...
Define a Button CFL and Tab CFL
<ChooseFromListCollection>
<action type="add">
<ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"/>
<ChooseFromList UniqueID="BtnCFL" ObjectType="2" MultiSelection="0" IsSystem="0"/>
<ChooseFromList UniqueID="TabCFL" ObjectType="2" MultiSelection="0" IsSystem="0"/>
</action>
</ChooseFromListCollection>
This is for BtnCFL XML..
<item uid="btn" type="4" left="205" tab_order="0" width="15" top="102" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific image="CHOOSE_ICON" ChooseFromListUID="BtnCFL"/>
</item>
This is for TabCFL XML..
<item uid="txtUid" type="16" left="124" tab_order="0" width="80" top="101" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific TabOrder="0" ChooseFromListUID="TabCFL" ChooseFromListAlias="CardCode">
<databind databound="1" table="@TABLENAME" alias="U_aaa"/>
</specific>
</item>
Give this code in ur item event..
Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
If pVal.BeforeAction = False Then
Dim cflevent As SAPbouiCOM.ChooseFromListEvent = pVal
Dim cfl As SAPbouiCOM.ChooseFromList
Dim a As String = cflevent.ChooseFromListUID
cfl = Conv_Form.ChooseFromLists.Item(a)
Dim dt As SAPbouiCOM.DataTable = cflevent.SelectedObjects
If Not (dt Is Nothing) Then
If cfl.UniqueID = "BtnCFL" Then
db.SetValue("U_aaa", db.Offset, dt.GetValue("CardCode", 0))
End If
If cfl.UniqueID = "TabCFL" Then
db.SetValue("U_aaa", db.Offset, dt.GetValue("CardCode", 0))
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Here's a sample of C# code to trap the choose from list event and return the selected value to the edittext:
private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if ( pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST )
{
SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
string sCFL_ID = null;
sCFL_ID = oCFLEvento.ChooseFromListUID;
SAPbouiCOM.Form oForm = null;
oForm = SBO_Application.Forms.Item(FormUID);
SAPbouiCOM.ChooseFromList oCFL = null;
oCFL = oForm.ChooseFromLists.Item(sCFL_ID);
if (oCFLEvento.BeforeAction == false)
{
SAPbouiCOM.DataTable oDataTable = null;
oDataTable = oCFLEvento.SelectedObjects;
string val = null;
try {
val = System.Convert.ToString(oDataTable.GetValue(0, 0));
}
catch ( Exception ex )
{
}
if (pVal.ItemUID == "EditTxt" | pVal.ItemUID == "Button")
{
oForm.DataSources.UserDataSources.Item( "EditDS" ).ValueEx = val;
}
}
}
if ( ( FormUID == "CFL1" ) & ( pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD ) ) {
System.Windows.Forms.Application.Exit();
}
}
The sample above assumes the ChooseFromList has an alias of CFL1 and is attached to an edittext id 'EditTxt' and a button id 'Button'. It is coded for SBO 2005A SP1 or earlier where the choosefromlist button was a separate control. In SBO 2007A, the button is built in to the edittext so your should change the line
if (pVal.ItemUID == "EditTxt" | pVal.ItemUID == "Button")
to
if (pVal.ItemUID == "EditTxt")
Kind Regards,
Owen
User | Count |
---|---|
97 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.