on 01-13-2004 12:06 PM
In the ScreenCode generator with version 6.5 I can build *.srl files.
The question is, Howcan I use this files in a Visual basic proyect, or how ca I use this files?
Hi,
You can use this to load userdefined forms much faster than adding forms and elements "on the fly".
Use the UI-API method : uiSBOApplication.LoadBatchActions(strXml as String)
To do this you should use an XML-parser to retrive the xml-string. I use Microsoft XML-parser, v3.0.
example (preconditions : create an menu-item):
Private Sub m_conApp_MenuEvent(pVal As SAPbouiCOM.MenuEvent, BubbleEvent As Boolean)
Dim oForm as new SAPbouiCOM.Form
If pVal.BeforeAction = True Then
Select Case pVal.MenuUID
Case "YOUR_FORM_UID" 'uid-parameter in srf-file
LoadFromXML "FILENAME.srf" ' see help-function below
Set oForm = m_conApp.Forms.Item("YOUR_FORM_UID")
oForm.Visible = True
End Select
End If
End Sub
'//**********************************************************************
'// Loading form from resource-file (****.srf)
'//**********************************************************************
Private Sub LoadFromXML(FileName As String)
Dim xmldoc As MSXML2.DOMDocument
Dim xml_err As IXMLDOMParseError
Set xmldoc = New MSXML2.DOMDocument
xmldoc.async = False
xmldoc.validateOnParse = True
'// load the content of the XML File
xmldoc.Load (App.Path + "Resources" + FileName)
Set xml_err = xmldoc.parseError
If (xml_err <> 0) Then
debug.print "Failed loading xml-doc..."
Else
'// load the form to the SBO application in one batch
uiSBOApplication.LoadBatchActions xmldoc.xml
End If
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you have trouble loading a form from XML, try opening up the XML file and editing it by hand. There are some characters that the Screen Painter will allow, but which are not handled as such by the XML parser because they are special characters. These include "#" and "&", for example. The parser will return xmldoc.xml = "".
When troubleshooting these issues, I have found that it is helpful to remove pieces from the XML document and testing it. This helps to isolate the problem. For example remove an entire Item by removing everything between . Then test it again. Once you have isolated the problem, see if you can fix it by hand and re-try.
In any case, the Screen Painter makes it MUCH easier to design forms for Business One. The other advantage of using LoadBatchActions with XML-based forms is that performance is much better.
User | Count |
---|---|
87 | |
7 | |
6 | |
4 | |
3 | |
3 | |
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.