
System.RunProgram("bingmaps:?where=106 Derby Street, Silverwater NSW, Australia","")
Note:
The above code is for Windows Store App/Phone implementations of BrightForms, and will open the default Bing Maps application to the location provided in the URI.
The address provided is "106 Derby Street, Silverwater NSW, Australia". Any URI special characters will be converted automatically.
Only the first parameter of RunProgram() is used, containing the URI to launch the application, with data provided. The second parameter is ignored.
System.RunProgram("http://maps.apple.com/?q=106%20Derby%20Street,%20Silverwater%20NSW,%20Australia","")
Note:
The above code is for iOS devices, and will open the URL specified with the device's mapping app - Apple Maps.
The URL domain provided - 'maps.apple.com' is a reserved domain for the device to launch the stock Apple Maps app on all devices. Specifying a different URL will open a web browser (with exception to YouTube or iTunes URLs, which will open those variants respectively). If Google Maps is to be used, and is installed on the device, the URL scheme "comgooglemaps://?q=..." may be used.
The address opened is "106 Derby Street, Silverwater NSW, Australia". Any URI special characters must be coded in the URI. This may be performed via the String.Replace() method for user inputted values, such as local.vUri = String.Replace(edtInput," ","%20");
Only the first parameter of RunProgram() is used, containing the URL to launch the application, with data provided. The second parameter is ignored.
System.RunProgram("geo:0,0?q=106 Derby Street, Silverwater NSW, Australia","android.intent.action.VIEW")
Note:
The above code is for Android, and will open the location specified with the default mapping application on the device.
The URI conforms to the Google Maps API specification.
On Android, the second parameter of RunProgram() is used to specify what action is to be taken with the URI - in this case it is "android.intent.action.VIEW". No additional parameters with System.SetObjectState() are required for this call. For more information, please refer to BrightForms on Android > Launching Applications via URI and Action in this document.
The address opened is "106 Derby Street, Silverwater NSW, Australia". Any URI special characters will be converted automatically.
If more than one application exists which can open the URI with VIEW action, and no default is provided, the user will be prompted to choose the application to run.
local.vHtmlFile = System.GetProjectPath() & "/" & "testfile.html";
local.vOpenStr = "content://com.android.htmlfileprovider" & local.vHtmlFile & "?text/html";
local.vOpenResult = System.RunProgram(local.vOpenStr, "android.intent.action.VIEW");
Note:
The above code is for Android, and will open html file specified by the local.vHtmlFile variable in the default Android HTML viewer.
System.RunProgram("C:\Program Files\Microsoft Office\Office10\WINWORD.EXE", "")
Form.Close()
Note:
The above code is for Windows Desktop or Mobile (with path change) will start the specified program, then close BrightForms.
"C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" – a string value of the complete path for MS WORD.
"" – the second parameter for RunProgram method specifying that no document is to be opened.
Form.Close – a Form Object method that closes the form. Refer to the Form Objects.
System.RunProgram("C:\Program Files\Microsoft Office\Office10\WINWORD.EXE", "")
Form.Close()
Note:
The above code is for Windows Desktop or Mobile (with path change) will start the specified program, then close BrightForms.
"C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" – a string value of the complete path for MS WORD.
"" – the second parameter for RunProgram method specifying that no document is to be opened.
Form.Close – a Form Object method that closes the form. Refer to the Form Objects.
System.RunProgram("C:\Program Files\Microsoft Office\Office10\WINWORD.EXE", "")
Note:
The above code is for Windows Desktop or Mobile (with path change) will open the specified file with the specified application.
"C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" – a string value of the complete path for MS WORD.
"" – the second parameter for RunProgram method specifying that no document is to be opened.
You can still use BrightForms application even if MS Word is already open.
System.RunProgramAndWait("C:\Program Files\BrightSoftware\BrightForms\BrightForms.exe", ""C:\DemoApps\export\DemoCustomer.bss"")
Note:
The above code is for Windows Desktop or Mobile (with path change) will open a new instance of BrightForms with different application.
"C:\Program Files\BrightSoftware\BrightForms\BrightForms.exe" – the complete path and name of the external program to run.
""C:\DemoApps\export\DemoCustomer.bss"" – the complete path and name of the application to open enclosed in double quotes.
The Main form for Test.bss application cannot be accessed until DemoCustomer.bss application is closed.
// Check username first.
IF System.IsUserNameCorrect(edtUserName)
{
// Check password.
IF System.IsPasswordCorrect(edtPassword)
{
// Open Main form if username and password are correct.
Form.ResetChildData()
Form.OpenChildForm("Main")
}
ELSE
{
// Display error message.
Form.MessageBox("Login", "Incorrect Password.", MB_ICONEXCLAMATION)
}
}
ELSE
{
// Display error message.
Form.MessageBox("Login", "Incorrect Username.", MB_ICONEXCLAMATION)
}
Note:
edtUserName and edtPassword – edit controls to enter username and password.
Link this expression to a Login button on a Login form.
Form.OpenChildForm method – opens the child form. Refer to Form Objects.
//Display the unique device ID assigned to device running BrightForms
label1 = System.GetDeviceId()
//Display project specific properties
label2 = System.GetProjectAuthor()
label3 = System.GetProjectDescription()
label4 = System.GetProjectId()
label5 = System.GetProjectVersion()
Note:
label1, label2, label3, label4, label5 – labels displaying the properties.
System.GetProjectId() returns the project ID that BrightServer has assigned the deployed project. If the project has not been deployed then it will return -1.
System.SetDialupEntry("Local Dialup")
Note:
This object method will set the RAS dialup entry to be used in synchronizing to BrightServer. RAS Dialup entries can be setup in the Dial Up tab in BrightForms Settings.
//Sleep for a second
System.Sleep(1000)
//Enable a button
button1.enable()
//Other actions
...
Note:
Pause the application to stop for a period of milliseconds.
intOSResult = System.GetOS()
IF OS_PPC == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is PPC OS"
}
IF OS_WIN32 == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is WIN32 OS"
}
IF OS_WINCE == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is WINCE"
}
IF OS_ANDROID == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is ANDROID"
}
IF OS_WEB == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is WEB"
}
IF OS_IOS == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is IOS"
}
IF OS_WINPHONE == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is WINPHONE"
}
IF OS_WINRT == intOSResult
{
edit_control1 = "OS Result is : " & intOSResult & CHAR_NEWLINE
edit_control1 = edit_control1 & "This is WINRT"
}
Note:
intOSResult – this is a form variable
OS_PPC, OS_WIN32, OS_WINCE, OS_ANDROID, OS_WEB – these are system constants used to evaluate the OS Id.
IF(System.GetOS() == OS_WEB)
{
local.vUserAgent = System.GetUserAgent();
IF(String.IndexOf(local.vUserAgent, "iPad", 0) <> -1 OR
String.IndexOf(local.vUserAgent, "iPhone", 0) <> -1)
{
//If iPhone or iPad
}
ELSE
{
//Any other web browser
}
}
Note:
The above code checks whether the connected device is an iPod or iPad through the user agent string.
local.vUserAgent– this is a variable which is assigned the user agent string
OS_WEB – system constant id for web OS.
IF(System.GetOS() == OS_WEB)
{
local.Filename = "C:/BrightServer/data/doc.pdf";
local.vFileDisplay = "important_document.pdf";
System.MarkFileForDownload(local.Filename, local.vFileDisplay);
}
Note:
When called, the above code will prompt the user to save a file
local.Filename – this is a local variable which describes the local file on the machine running BrightWeb.
local.vFileDisplay – this is the file name which is displayed to the end user in the browser dialog.