on 07-14-2005 1:39 PM
I was wondering if anyone has a C# or VB.NET example of how to add a choose list icon to an edit text field. I also want the text field to allow for the tabbing functionality. (Hit tab and open lookup form).
I am using the 2004 SDK.
I have found some posts referencing this but no good examples.
Hi Laura!
i havn't an example, but i know two decisions:
<b>1.</b> develop ActiveX obj for your purpose
<i>or</i>
<b>2.</b> put on form a comboBox, and put edittext <b>over</b> comboBox - so you'll get a needed control. in this case you will have to implement all logic to manage edittext/comboBox events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thought I would post some of my code for this in case any one else is trying to do the same thing. This code is in no way complete but it should give u an idea of what you need to do. Thanks so much to Felipe Ortega Aguilar for all his help and sample code. Hopefully this example will help anyone who tries to create this functionality using the 2004 SDK. As others have mentioned this object is available in 2005.
(I saved the SAP choose item form via XML and then tweaked it to create my choose item form)
Step 1 - You add a image button to your form either through screen painter or via xml.
Step 2- Handle the click event for this image button in your form to open your choose item form.
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = False Then
'*
If pVal.ItemUID = "Icon1" Then
m_loadForm.LoadXmlForm("FrmChooseBP.xml")
l_gui = B1_Application.Forms.ActiveForm.UniqueID()
GetBP_List(l_gui)
End If
Step 3 - Load data into choose item form
m_Form2 = B1_Application.Forms.Item(a_formuid)
'Set DBDataSources
oDBDataSource = m_Form2.DataSources.DBDataSources.Add("OCRD")
'Bind Data to Matrix
oMatrix = m_Form2.Items.Item("Matrix2").Specific
oColumns = oMatrix.Columns
oColumn = oColumns.Item("Col1")
oColumn.DataBind.SetBound(True, "OCRD", "CardCode")
oColumn = oColumns.Item("Col2")
oColumn.DataBind.SetBound(True, "OCRD", "CardName")
oMatrix.Clear()
oMatrix.AutoResizeColumns()
oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single
oDBDataSource.Query()
oMatrix.LoadFromDataSource()
Step 4 - Code your choose item form to handle click events on the matrix and update button.
Other Notes:
If you wanted to add a linked object (gold arrow) to the edit text you are using here is some sample code for that:
XML METHOD
<item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="16" left="89" linkto="EditCode" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="17" type="116" uid="BPlink" visible="1" width="23">
<AutoManagedAttribute />
<specific linkedObject="2" />
</item>
PROGRAMATICALLY
' Linked Button
oItem = oForm.Items.Add("BPLink", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
oItem.Left = 53
oItem.Top = 10
oItem.LinkTo = "EditCode"
oItem.Visible = True
oLinked = oItem.Specific
oLinked.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
Hi Laura!
when i was writing my previous post i thought that you wanted to implement lookup-edittext - it is a combination
of EditText and ComboBox - you can put some text in field
and you can also choose textvalue from list.
if anyone have already implemented what i am talking
about, please tell or share your thoughts, was it too difficult and was there
any troubles?
gurus from SAP, are you going to expose that UI-object
in future versions?
thanx!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
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.